Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/resolve/Refinery
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwood committed Sep 14, 2009
2 parents 8877024 + 1f91f21 commit 9c60140
Show file tree
Hide file tree
Showing 16 changed files with 159 additions and 156 deletions.
9 changes: 9 additions & 0 deletions db/migrate/20090914025122_change_default_image_thumbnails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class ChangeDefaultImageThumbnails < ActiveRecord::Migration
def self.up
RefinerySetting[:image_thumbnails] = RefinerySetting[:image_thumbnails].merge({:grid => 'c135x135'})
end

def self.down
RefinerySetting[:image_thumbnails] = RefinerySetting[:image_thumbnails].delete_if {|key, value| key == :grid }
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20090903030652) do
ActiveRecord::Schema.define(:version => 20090914025122) do

create_table "images", :force => true do |t|
t.integer "parent_id"
Expand Down
18 changes: 10 additions & 8 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
{:name => "signup_enabled", :value => true},
{:name => "new_page_parts", :value => true},
{:name => "analytics_page_code", :value => "UA-xxxxxx-x"},
{:name => "image_thumbnails", :value => "{
:lightbox => '500x500>',
:dialog_thumb => 'c106x106',
:thumb => '50x50',
:medium => '225x255',
:side_body => '300x500',
:preview => 'c96x96'
}"}].each do |setting|
{:name => "image_thumbnails", :value => {
:lightbox => '500x500>',
:dialog_thumb => 'c106x106',
:grid => 'c135x135',
:thumb => '50x50',
:medium => '225x255',
:side_body => '300x500',
:preview => 'c96x96'
}
}].each do |setting|
RefinerySetting[setting[:name].to_sym] = setting[:value]
RefinerySetting.find_by_name(setting[:name].to_s).update_attributes({:destroyable => false})
end
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/admin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
init_tooltips = function(){
$$('a[title]').each(function(element)
$$('a[title]', '#image_grid img[title]').each(function(element)
{
new Tooltip(element, {mouseFollow:false, delay: 0, opacity: 1, appearDuration:0, hideDuration: 0, rounded: false});
})
Expand Down
35 changes: 23 additions & 12 deletions public/stylesheets/refinery.css
Original file line number Diff line number Diff line change
Expand Up @@ -982,19 +982,30 @@ textarea.wymeditor {
padding: 10px;
}

/* Image Grid Styles */
ul#image_grid {
width: 580px;
padding: 0px;
margin: 0px;
}

.image_grid_item {
float: left;
padding: 5px 15px;
text-align: center;
margin: 5px 7px;
background-color: #EEE;
border: 1px solid #666;
ul#image_grid li {
float: left;
margin: 0px 13px 12px 0px;
padding: 0px;
width: 135px;
text-align: center;
height: 176px;
}
.image_grid_item a {
border: 0 none;
ul#image_grid li.row-end {
margin-right: 0px;
float: right;
}
ul#image_grid li a {
border: 0 none;
}
.image_grid_item p {
margin: 3px 0;
ul#image_grid li p {
margin: 3px 0;
}
ul#image_grid li span.actions {
width: 100%;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Admin::ImagesController < Admin::BaseController
include Admin::ImagesHelper

crudify :image, :order => "created_at DESC", :conditions => "parent_id is NULL", :sortable => false
before_filter :change_list_mode_if_specified

Expand Down Expand Up @@ -46,7 +46,7 @@ def create
@image = nil
self.insert
end
end
end

protected
def paginate_images
Expand Down
34 changes: 15 additions & 19 deletions vendor/plugins/images/app/helpers/admin/images_helper.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
module Admin::ImagesHelper

def image_views
["grid", "list"]
end

def current_image_view
session[:image_view] || :list
end

def alternate_image_view
image_views.reject {|i| i == current_image_view.to_s }[0]
end

def change_list_mode_if_specified
if params[:action] == "index" and not params[:view].blank?
session[:image_view] = params[:view] if ["grid", "list"].include?(params[:view])
end
end


def image_views
RefinerySetting.find_or_set(:image_views, [:grid, :list])
end

def current_image_view
RefinerySetting.find_or_set(:preferred_image_view, :list)
end

def change_list_mode_if_specified
unless params[:action] != "index" or params[:view].blank? or !image_views.include? params[:view].to_sym
RefinerySetting[:preferred_image_view] = params[:view]
end
end

end
29 changes: 13 additions & 16 deletions vendor/plugins/images/app/views/admin/images/_grid_view.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<div id="image_grid" class="clearfix">
<ul id="image_grid" class="clearfix">
<% @images.each do |image| -%>
<div id="image_<%= image.id %>" class="image_grid_item">
<p><%= image_tag( image.public_filename(:preview), :title => h(image.title) ) %></p>
<p title="<%=h image.title %>">
<%=h truncate(image.title, :length => 15) %>
</p>
<p>
<%= link_to image_tag('refinery/icons/application_edit.png'), edit_admin_image_path(image),
:title => 'Edit this image' %>
<%= link_to image_tag('refinery/icons/delete.png'), admin_image_path(image),
:confirm => "Are you sure you want to delete #{image.title}?",
:class => "cancel", :method => :delete,
:title => "Remove this image forever" %>
</p>
</div>
<li id="image_<%= image.id %>" <%= "class='row-end'" if (@images.index(image)+1) % 4 == 0 %>>
<%= image_fu image, :grid, :title => image.title %>
<span class='actions'>
<%= link_to image_tag('refinery/icons/application_edit.png'), edit_admin_image_path(image),
:title => 'Edit this image' %>
<%= link_to image_tag('refinery/icons/delete.png'), admin_image_path(image),
:confirm => "Are you sure you want to delete #{image.title}?",
:class => "cancel", :method => :delete,
:title => "Remove this image forever" %>
</span>
</li>
<% end -%>
</div>
</ul>
30 changes: 15 additions & 15 deletions vendor/plugins/images/app/views/admin/images/_list_view.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<ul>
<% @images.each do |image| -%>
<li id="sortable_<%= image.id %>" class='clearfix record <%= cycle("on", "on-hover") %>'>
<span class='title'>
<span class='actions'>
<%= link_to image_tag('refinery/icons/eye.png'), image.public_filename,
:target => "_blank", :title => "#{image_tag image.public_filename(:preview)}" %>
<%= link_to image_tag('refinery/icons/application_edit.png'), edit_admin_image_path(image),
:title => 'Edit this image' %>
<%= link_to image_tag('refinery/icons/delete.png'), admin_image_path(image),
:confirm => "Are you sure you want to delete #{image.title}?",
:class => "cancel", :method => :delete,
:title => "Remove this image forever" %>
</span>
<%=h image.title %> <span class="preview">&nbsp;</span>
</span>
</li>
<li id="sortable_<%= image.id %>" class='clearfix record <%= cycle("on", "on-hover") %>'>
<span class='title'>
<span class='actions'>
<%= link_to image_tag('refinery/icons/eye.png'), image.public_filename,
:target => "_blank", :title => "#{image_fu image, :preview}" %>
<%= link_to image_tag('refinery/icons/application_edit.png'), edit_admin_image_path(image),
:title => 'Edit this image' %>
<%= link_to image_tag('refinery/icons/delete.png'), admin_image_path(image),
:confirm => "Are you sure you want to delete #{image.title}?",
:class => "cancel", :method => :delete,
:title => "Remove this image forever" %>
</span>
<%= image.title %> <span class="preview">&nbsp;</span>
</span>
</li>
<% end -%>
</ul>
20 changes: 10 additions & 10 deletions vendor/plugins/images/app/views/admin/images/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<div id='actions'>
<h2>Actions</h2>
<ul>
<li>
<%= link_to "Create New Image", new_admin_image_url, :class => "add_icon" %>
</li>
</ul>
<ul>
<li>
<%= link_to "Switch to #{alternate_image_view.capitalize} View",
admin_images_url(:view => alternate_image_view, :page => params[:page]),
:class => "reorder_icon" %>
</li>
<% image_views.delete_if {|image_view| image_view.to_s == current_image_view.to_s }.each do |image_view| %>
<li>
<%= link_to "Switch to #{image_view.to_s.titleize} View",
admin_images_url(:view => image_view, :page => params[:page]),
:class => "reorder_icon" %>
</li>
<% end %>
</ul>
</div>
<div id='records'>
<% if @images.size > 0 %>
<h2>Images</h2>
<%= will_paginate @images, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<%= render :partial => "#{current_image_view}_view" %>
<%= will_paginate @images, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<%= will_paginate @images, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<%= render :partial => "#{current_image_view}_view" %>
<%= will_paginate @images, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<% else %>
<p>
<strong>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div id='actions'>
<h2>Actions</h2>
<ul>
<li>
<%= link_to "Update who gets notified", edit_admin_inquiry_setting_url(InquirySetting.notification_recipients),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<h1>Inquiries Settings</h1>
<div id='actions'>
<h2>Actions</h2>
<ul>
<li>
<%= link_to "#{image_tag 'refinery/icons/user_comment.png'} Update who gets notified",
Expand All @@ -13,23 +11,22 @@
</ul>
</div>
<div id='records'>
<h2>Existing Settings</h2>
<% if @inquiry_settings.size > 0 %>
<ul>
<% @inquiry_settings.each do |setting| -%>
<li class='clearfix record <%= cycle("on", "on-hover") %>'>
<span class='title'>
<span class='actions'>
<%= link_to image_tag("refinery/icons/application_edit.png", :alt => "Edit"), edit_admin_inquiry_setting_path(setting) %>
<%= link_to image_tag("refinery/icons/delete.png", :alt => "Delete"), admin_inquiry_setting_path(setting),
:confirm => "Are you sure you want to delete #{setting.name}?",
:class => "cancel", :method => :delete ,
:title => "Remove this inquiry setting forever" if setting.destroyable? %>
<% @inquiry_settings.each do |setting| -%>
<li class='clearfix record <%= cycle("on", "on-hover") %>'>
<span class='title'>
<span class='actions'>
<%= link_to image_tag("refinery/icons/application_edit.png", :alt => "Edit"), edit_admin_inquiry_setting_path(setting) %>
<%= link_to image_tag("refinery/icons/delete.png", :alt => "Delete"), admin_inquiry_setting_path(setting),
:confirm => "Are you sure you want to delete #{setting.name}?",
:class => "cancel", :method => :delete ,
:title => "Remove this inquiry setting forever" if setting.destroyable? %>
</span>
<span><%=h setting.name %></span>
</span>
<span><%=h setting.name %></span>
</span>
</li>
<% end -%>
</li>
<% end -%>
</ul>
<% end -%>
</div>
42 changes: 20 additions & 22 deletions vendor/plugins/news/app/views/admin/news_items/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div id='actions'>
<h2>Actions</h2>
<ul>
<li>
<%= link_to "Create News Item", new_admin_news_item_url, :class => "add_icon" %>
Expand All @@ -8,28 +7,27 @@
</div>
<div id='records'>
<% if @news_items.size > 0 %>
<h2>News Items</h2>
<%= will_paginate @news_items, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<ul>
<% @news_items.each do |news_item| %>
<li class='clearfix record <%= cycle("on", "on-hover") %>'>
<span class='title'>
<span class='actions'>
<%= link_to image_tag('refinery/icons/application_go.png'), news_item_url(news_item),
:title => 'View this news item live <br/><em>(opens in a new window)</em>', :target => "_blank" %>
<%= link_to image_tag('refinery/icons/application_edit.png'), edit_admin_news_item_path(news_item),
:title => 'Edit this news item' %>
<%= link_to image_tag('refinery/icons/delete.png'), admin_news_item_path(news_item),
:confirm => "Are you sure you want to delete #{news_item.title}?",
:class => "cancel", :method => :delete,
:title => "Remove this news item forever" %>
</span>
<%=h news_item.title %> <span class="preview">&nbsp;</span>
<%= will_paginate @news_items, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<ul>
<% @news_items.each do |news_item| %>
<li class='clearfix record <%= cycle("on", "on-hover") %>'>
<span class='title'>
<span class='actions'>
<%= link_to image_tag('refinery/icons/application_go.png'), news_item_url(news_item),
:title => 'View this news item live <br/><em>(opens in a new window)</em>', :target => "_blank" %>
<%= link_to image_tag('refinery/icons/application_edit.png'), edit_admin_news_item_path(news_item),
:title => 'Edit this news item' %>
<%= link_to image_tag('refinery/icons/delete.png'), admin_news_item_path(news_item),
:confirm => "Are you sure you want to delete #{news_item.title}?",
:class => "cancel", :method => :delete,
:title => "Remove this news item forever" %>
</span>
</li>
<% end %>
</ul>
<%= will_paginate @news_items, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<%=h news_item.title %> <span class="preview">&nbsp;</span>
</span>
</li>
<% end %>
</ul>
<%= will_paginate @news_items, :previous_label => '&laquo;', :next_label => '&raquo;' %>
<% else %>
<p>
<strong>
Expand Down
20 changes: 9 additions & 11 deletions vendor/plugins/pages/app/views/admin/pages/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div id='actions'>
<h2>Actions</h2>
<ul>
<li>
<%= link_to "Create New Page", new_admin_page_url, :class => "add_icon" %>
Expand All @@ -13,15 +12,14 @@
</ul>
</div>
<div id='records' class='tree'>
<% if @pages.size > 0 %>
<h2>Pages</h2>
<ul id='sortable_list'>
<%= render :partial => "sortable_list" %>
</ul>
<% else %>
<p>
<strong>There are no pages yet. Click "Create New Page" to add your first page.</strong>
</p>
<% end %>
<% if @pages.size > 0 %>
<ul id='sortable_list'>
<%= render :partial => "sortable_list" %>
</ul>
<% else %>
<p>
<strong>There are no pages yet. Click "Create New Page" to add your first page.</strong>
</p>
<% end %>
</div>
<%= render :partial => "/shared/admin/make_sortable", :locals => {:tree => true } if Page.count > 1 %>
Loading

0 comments on commit 9c60140

Please sign in to comment.