Commit 217715fd

mo khan <mo@mokhan.ca>
2013-06-22 03:06:20
clean up carrierwave configuration
1 parent c7cc92f
Changed files (5)
app/models/user.rb
@@ -9,7 +9,6 @@ class User < ActiveRecord::Base
   has_and_belongs_to_many :interests, :join_table => 'users_interests', :uniq => true, :autosave => true
   has_one :avatar
   acts_as_tagger
-  default_scope order("created_at DESC")
   before_save :ensure_authentication_token
 
   def add_favorite(creation)
app/uploaders/avatar_uploader.rb
@@ -1,60 +1,18 @@
-# encoding: utf-8
-
 class AvatarUploader < CarrierWave::Uploader::Base
   include CarrierWave::RMagick
   include CarrierWave::MimeTypes
 
-  # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
-  # include Sprockets::Helpers::RailsHelper
-  # include Sprockets::Helpers::IsolatedHelper
-
-  # Choose what kind of storage to use for this uploader:
-  if Rails.env.production?
-    storage :fog
-  elsif Rails.env.staging?
-    storage :fog
-  elsif Rails.env.development?
-    storage :file
-  else
-    storage :file
-  end
-
-  # Override the directory where uploaded files will be stored.
-  # This is a sensible default for uploaders that are meant to be mounted:
   def store_dir
     "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
   end
 
   process :set_content_type
   process :resize_to_fit => [1160, 870]
-  process :convert => 'png'
 
   version :thumb do
     process :resize_to_fill => [260, 260]
   end
 
-  # Provide a default URL as a default if there hasn't been a file uploaded:
-  # def default_url
-  #   # For Rails 3.1+ asset pipeline compatibility:
-  #   # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
-  #
-  #   "/images/fallback/" + [version_name, "default.png"].compact.join('_')
-  # end
-
-  # Process files as they are uploaded:
-  # process :scale => [200, 300]
-  #
-  # def scale(width, height)
-  #   # do something
-  # end
-
-  # Create different versions of your uploaded files:
-  # version :thumb do
-  #   process :scale => [50, 50]
-  # end
-
-  # Add a white list of extensions which are allowed to be uploaded.
-  # For images you might use something like this:
   def extension_white_list
     %w(jpg jpeg gif png)
   end
@@ -64,9 +22,9 @@ class AvatarUploader < CarrierWave::Uploader::Base
   # def filename
   #   "something.jpg" if original_filename
   # end
-  def filename
-    if original_filename 
-      super.chomp(File.extname(super)) + '.png'
-    end
-  end
+  #def filename
+    #if original_filename 
+      #super.chomp(File.extname(super)) + '.png'
+    #end
+  #end
 end
app/uploaders/photo_uploader.rb
@@ -1,34 +1,20 @@
 # encoding: utf-8
-
 class PhotoUploader < CarrierWave::Uploader::Base
   include CarrierWave::RMagick
   include CarrierWave::MimeTypes
   include ::CarrierWave::Backgrounder::Delay
 
-  if Rails.env.production?
-    storage :fog
-  elsif Rails.env.staging?
-    storage :fog
-  elsif Rails.env.development?
-    storage :file
-  else
-    storage :file
-  end
-
   def store_dir
     "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
   end
 
   process :set_content_type
 
-  # Create different versions of your uploaded files:
   version :large do 
-    #process :convert => 'png'
     process :resize_to_fit => [570, 630]
     process :watermark
   end
   version :thumb, :from_version => :large do
-    #process :convert => 'png'
     process :resize_to_fill => [260, 180]
   end
 
app/views/creations/show.html.erb
@@ -36,17 +36,23 @@
         <a href="/tags/<%= tag.name %>"><span class="label"><%= tag.name %></span></a>
       <% end -%>
     <% end -%>
-    <% if user_signed_in? %>
-      <% unless current_user == @creation.user || current_user.already_likes(@creation) %>
-        <%= button_to "ADD TO FAVORITES", creation_favorites_path(:creation_id => @creation.id), :method => :post, :class => 'btn btn-primary' %>
-      <% end %>
-    <% else %>
-        <p><%= link_to "SIGN UP FOR FREE", new_user_session_path, :class => "btn btn-primary" %></p>
-    <% end %>
+    <div class="row">
+      <div class="span3">
+        <% if user_signed_in? %>
+          <% unless current_user == @creation.user || current_user.already_likes(@creation) %>
+            <%= button_to "ADD TO FAVORITES", creation_favorites_path(:creation_id => @creation.id), :method => :post, :class => 'btn btn-primary' %>
+          <% end %>
+        <% else %>
+          <p><%= link_to "SIGN UP FOR FREE", new_user_session_path, :class => "btn btn-primary" %></p>
+        <% end %>
+      </div>
+      <div class="span3">
+      </div>
+    </div>
     <p><%= @creation.story %></p>
   </div>
 </div>
-<% if @creation.photos.count > 1 %>
+<% if @creation.photos.size > 1 %>
 <div class="row">
   <div class="span12">
     <ul class="thumbnails">
app/views/layouts/application.html.erb
@@ -8,6 +8,8 @@
     <meta name="google-site-verification" content="X9sZ3dovM2s1pJg68Bb0q1oRqqiJYdzAwGeaGlOy6PM" />
     <meta name="description" content="<%= yield(:description) %>" />
     <%= stylesheet_link_tag :application %>
+    <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
+    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
     <%= favicon_link_tag 'favicon.ico' %>
     <%= favicon_link_tag 'apple-touch-icon-57x57.png', :rel => 'apple-touch-icon', :type => 'image/png', :sizes => "57x57" %>
     <%= favicon_link_tag 'apple-touch-icon-72x72.png', :rel => 'apple-touch-icon', :type => 'image/png', :sizes => "72x72" %>