portfolio 0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CONTRIBUTORS +2 -0
- data/LICENSE +21 -0
- data/README +14 -0
- data/app/controllers/admin/portfolio_entries_controller.rb +5 -0
- data/app/controllers/portfolio_controller.rb +43 -0
- data/app/models/portfolio_entry.rb +27 -0
- data/app/views/admin/portfolio_entries/_form.html.erb +39 -0
- data/app/views/admin/portfolio_entries/_list.html.erb +29 -0
- data/app/views/admin/portfolio_entries/_sortable_list.html.erb +4 -0
- data/app/views/admin/portfolio_entries/edit.html.erb +1 -0
- data/app/views/admin/portfolio_entries/index.html.erb +30 -0
- data/app/views/admin/portfolio_entries/new.html.erb +1 -0
- data/app/views/portfolio/empty.html.erb +10 -0
- data/app/views/portfolio/show.html.erb +41 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20090917224823_create_portfolio_structure.rb +46 -0
- data/init.rb +14 -0
- data/lib/tasks/tasks.rake +12 -0
- data/portfolio.gemspec +18 -0
- data/public/javascripts/portfolio.js +57 -0
- data/public/stylesheets/portfolio.css +64 -0
- metadata +78 -0
data/CONTRIBUTORS
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
== MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2005-2009 Resolve Digital Ltd.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Portfolio plugin for RefineryCMS
|
2
|
+
http://www.refinerycms.com
|
3
|
+
http://github.com/resolve/Refinery
|
4
|
+
|
5
|
+
By: Resolve Digital Ltd
|
6
|
+
http://www.resolvedigital.com
|
7
|
+
|
8
|
+
Just 'git clone' Refinery, install this as a plugin using:
|
9
|
+
script/plugin install git://github.com/resolve/portfolio.git
|
10
|
+
|
11
|
+
Then run:
|
12
|
+
rake portfolio:install
|
13
|
+
|
14
|
+
..and follow the instructions!
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class PortfolioController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :load_page, :only => [:index, :show, :empty]
|
4
|
+
|
5
|
+
def index
|
6
|
+
redirect_to portfolio_url(PortfolioEntry.find(:first, :order => "position ASC", :conditions => "parent_id IS NULL")) rescue error_404
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
begin
|
11
|
+
if params[:id]
|
12
|
+
@master_entry = PortfolioEntry.find(params[:id])
|
13
|
+
else
|
14
|
+
@master_entry = PortfolioEntry.find(:first, :order => "position ASC", :conditions => "parent_id IS NULL")
|
15
|
+
end
|
16
|
+
|
17
|
+
if params[:portfolio_id]
|
18
|
+
@portfolio_entry = @master_entry.children.find(params[:portfolio_id])
|
19
|
+
else
|
20
|
+
@portfolio_entry = @master_entry.children.first
|
21
|
+
end
|
22
|
+
|
23
|
+
begin
|
24
|
+
if params[:image_id]
|
25
|
+
@image = @portfolio_entry.images[params[:image_id].to_i]
|
26
|
+
else
|
27
|
+
@image = @portfolio_entry.images.first
|
28
|
+
end
|
29
|
+
rescue
|
30
|
+
render :action => "empty"
|
31
|
+
end
|
32
|
+
rescue
|
33
|
+
error_404
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
def load_page
|
40
|
+
@page = Page.find_by_link_url('/portfolio', :include => [:parts, :slugs])
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class PortfolioEntry < ActiveRecord::Base
|
2
|
+
|
3
|
+
validates_presence_of :title
|
4
|
+
|
5
|
+
has_friendly_id :title, :use_slug => true, :strip_diacritics => true
|
6
|
+
|
7
|
+
acts_as_tree :order => "position"
|
8
|
+
has_and_belongs_to_many :images
|
9
|
+
|
10
|
+
def content
|
11
|
+
self.body
|
12
|
+
end
|
13
|
+
|
14
|
+
def content=(value)
|
15
|
+
self.body = value
|
16
|
+
end
|
17
|
+
|
18
|
+
def image_ids=(ids)
|
19
|
+
self.images.clear
|
20
|
+
|
21
|
+
ids.reject{|id| id.blank? }.each do |image_id|
|
22
|
+
image = Image.find(image_id.to_i) rescue nil
|
23
|
+
self.images << image unless image.nil?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<% insert_args = "?thickbox=true&modal=true&titlebar=true&field=portfolio_entry_image_id&callback=image_added&update_image=current_portfolio_entry_image&thumbnail=grid&KeepThis=true&TB_iframe=true&width=950&height=510" %>
|
2
|
+
<%= error_messages_for :portfolio_entry %>
|
3
|
+
<% form_for [:admin, @portfolio_entry] do |f| %>
|
4
|
+
<div class='field'>
|
5
|
+
<%= f.label :title %>
|
6
|
+
<%= f.text_field :title, :class => "larger", :style => 'width: 954px' %>
|
7
|
+
</div>
|
8
|
+
<div class='field images_field'>
|
9
|
+
<span class='clearfix label_inline_with_link'>
|
10
|
+
<%= label_tag('portfolio_entry_image_ids', 'Images') %>
|
11
|
+
<%= link_to "#{refinery_icon_tag "add.png"} Add", "#{insert_admin_images_url}#{insert_args}", :class => "thickbox", :name => "Add Another Image", :id => "add_image_link" %>
|
12
|
+
</span>
|
13
|
+
<ul id='portfolio_images' class='clearfix portfolio_entry_images'>
|
14
|
+
<% @portfolio_entry.images.each do |image| %>
|
15
|
+
<li id='image_<%= image.id %>'>
|
16
|
+
<%= image_fu image, :grid %>
|
17
|
+
<%= hidden_field_tag 'portfolio_entry[image_ids][]', image.id, :id => "portfolio_entry_image_id_#{image.id}" %>
|
18
|
+
</li>
|
19
|
+
<% end %>
|
20
|
+
<li class='empty'>
|
21
|
+
<img id="current_portfolio_entry_image" src="" alt="" style='display: none' />
|
22
|
+
<input type='hidden' id='portfolio_entry_image_id' name='portfolio_entry[image_ids][]' />
|
23
|
+
</li>
|
24
|
+
</ul>
|
25
|
+
</div>
|
26
|
+
<div class='field clearfix' style='width: 963px'>
|
27
|
+
<%= f.label :body, 'Content' %>
|
28
|
+
<%= f.text_area :body, :class => "wymeditor", :rows => 7 %>
|
29
|
+
</div>
|
30
|
+
<div class='form-actions'>
|
31
|
+
<%= f.submit 'Save', :class => "wymupdate" %>
|
32
|
+
or
|
33
|
+
<%= link_to "Cancel", admin_portfolio_entries_url, :title => "Cancelling will lose all changes you've made to this entry" %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
<% content_for :head do %>
|
37
|
+
<%= stylesheet_link_tag 'portfolio' %>
|
38
|
+
<%= javascript_include_tag 'portfolio' %>
|
39
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<%
|
2
|
+
branch = if entry === @portfolio_entries.first
|
3
|
+
"branch_start"
|
4
|
+
elsif entry === @portfolio_entries.last or (entry.parent and entry === entry.parent.children.last)
|
5
|
+
"branch_end"
|
6
|
+
end
|
7
|
+
-%>
|
8
|
+
<li class='clearfix record<%= " #{branch}" %>' id="<%= dom_id(entry) -%>">
|
9
|
+
<div class='clearfix'>
|
10
|
+
<span class='actions'>
|
11
|
+
<% url = entry.parent ? portfolio_project_url(entry.parent, entry) : portfolio_url(entry) %>
|
12
|
+
<%= link_to refinery_icon_tag('application_go.png'), url, :target => "_blank",
|
13
|
+
:title => "View this entry live <br/><em>(opens in a new window)</em>" %>
|
14
|
+
<%= link_to refinery_icon_tag('application_edit.png'), edit_admin_portfolio_entry_path(entry),
|
15
|
+
:title => "Edit this entry" %>
|
16
|
+
<%= link_to refinery_icon_tag('delete.png'), admin_portfolio_entry_path(entry),
|
17
|
+
:confirm => "Are you sure you want to delete '#{entry.title}'?", :class => "cancel",
|
18
|
+
:method => :delete,
|
19
|
+
:title => "Remove this entry forever" %>
|
20
|
+
</span>
|
21
|
+
<%=h entry.title %>
|
22
|
+
</div>
|
23
|
+
<ul<%= " class='empty'" if entry.children.empty? %>>
|
24
|
+
<% entry.children.each do |child| %>
|
25
|
+
<%= render :partial => 'list', :locals => {:entry => child} %>
|
26
|
+
<% end %>
|
27
|
+
<span class='spacing'> </span>
|
28
|
+
</ul>
|
29
|
+
</li>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<h2>Actions</h2>
|
3
|
+
<ul>
|
4
|
+
<li>
|
5
|
+
<%= link_to "Create New Portfolio Entry", new_admin_portfolio_entry_url, :class => "add_icon" %>
|
6
|
+
</li>
|
7
|
+
<% if PortfolioEntry.count > 1 %>
|
8
|
+
<li>
|
9
|
+
<%= link_to "Reorder Portfolio", "", :id => "reorder_action", :class => "reorder_icon" %>
|
10
|
+
<%= link_to "Done Reordering Portfolio", "", :id => "reorder_action_done", :style => "display: none;", :class => "reorder_icon" %>
|
11
|
+
</li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<div id='records' class='tree'>
|
16
|
+
<% if @portfolio_entries.size > 0 %>
|
17
|
+
<h2>Portfolio</h2>
|
18
|
+
<ul id='sortable_list'>
|
19
|
+
<%= render :partial => 'sortable_list' %>
|
20
|
+
</ul>
|
21
|
+
<% else %>
|
22
|
+
<p>
|
23
|
+
<strong>
|
24
|
+
There are no portfolio entries yet.
|
25
|
+
Click "Create New Portfolio Entry" to add your first portfolio entries.
|
26
|
+
</strong>
|
27
|
+
</p>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
<%= render :partial => "/shared/admin/make_sortable", :locals => {:tree => true } if PortfolioEntry.count > 1 %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% content_for :title, "#{@master_entry.title} - " %>
|
2
|
+
<% content_for :head, stylesheet_link_tag('portfolio') %>
|
3
|
+
<div id='body_content' class='clearfix'>
|
4
|
+
<div id='body_content_left' class='clearfix'>
|
5
|
+
<h1><%= @master_entry.title %></h1>
|
6
|
+
<p>
|
7
|
+
<em>We haven't entered anything in for this project yet.</em>
|
8
|
+
</p>
|
9
|
+
</div>
|
10
|
+
</div>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<% content_for :title, "#{@portfolio_entry.title} - " %>
|
2
|
+
<% content_for :head, stylesheet_link_tag('portfolio') %>
|
3
|
+
<div id='body_content' class='clearfix portfolio'>
|
4
|
+
<div id='body_content_left' class='clearfix'>
|
5
|
+
<h1 class='clearfix'>
|
6
|
+
<span><%= @master_entry.title %></span>
|
7
|
+
<%= select :portfolio_entry, :to_param, @master_entry.children.collect{|entry| [entry.title, entry.to_param] } %>
|
8
|
+
</h1>
|
9
|
+
|
10
|
+
<%= image_fu @image, :portfolio, :id => "portfolio_main_image" unless @image.nil? %>
|
11
|
+
</div>
|
12
|
+
<div id='body_content_right' class='clearfix'>
|
13
|
+
<h2><%= @portfolio_entry.title %></h2>
|
14
|
+
<ul id='portfolio_images'>
|
15
|
+
<% (images = @portfolio_entry.images).each do |image| %>
|
16
|
+
<li class='<%= cycle("odd", "even") %>'>
|
17
|
+
<% className = (selected = images.index(image) == params[:image_id].to_i) ? "selected" : "pale" %>
|
18
|
+
<%= link_to_if !selected,
|
19
|
+
image_fu(image, :portfolio_thumb, :class => className),
|
20
|
+
portfolio_image_url(@master_entry, @portfolio_entry, images.index(image)) %>
|
21
|
+
</li>
|
22
|
+
<% end %>
|
23
|
+
</ul>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<% content_for :head do %>
|
27
|
+
<%# remove these javascript_include_tag calls if they are included in your layout.
|
28
|
+
%>
|
29
|
+
<%= javascript_include_tag 'prototype', 'fastinit' %>
|
30
|
+
<script type='text/javascript'>
|
31
|
+
FastInit.addOnLoad(function(){
|
32
|
+
$$("ul#portfolio_images li img.pale").each(function(img){
|
33
|
+
img.setOpacity(0.3);
|
34
|
+
});
|
35
|
+
|
36
|
+
$('portfolio_entry_to_param').observe('change', function(e){
|
37
|
+
window.location = "<%= portfolio_project_url(@master_entry, nil) %>" + this.value;
|
38
|
+
});
|
39
|
+
});
|
40
|
+
</script>
|
41
|
+
<% end %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
|
3
|
+
map.portfolio_project "/portfolio/:id/projects/:portfolio_id", :controller => "portfolio", :action => "show"
|
4
|
+
map.portfolio_image "/portfolio/:id/projects/:portfolio_id/:image_id", :controller => "portfolio", :action => "show"
|
5
|
+
map.portfolio "/portfolio/:id/", :controller => 'portfolio', :action => 'show'
|
6
|
+
|
7
|
+
map.resources :portfolio do |portfolio|
|
8
|
+
portfolio.resources :portfolio, :as => :portfolio
|
9
|
+
end
|
10
|
+
|
11
|
+
map.namespace(:admin) do |admin|
|
12
|
+
admin.resources :portfolio_entries, :as => :portfolio
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class CreatePortfolioStructure < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :images_portfolio_entries, :id => false, :force => true do |t|
|
4
|
+
t.integer :image_id
|
5
|
+
t.integer :portfolio_entry_id
|
6
|
+
end
|
7
|
+
|
8
|
+
# people should be allowed to have the same image twice, if they really want to.
|
9
|
+
#add_index :images_portfolio_entries, [:image_id, :portfolio_entry_id], :name => :composite_key_index, :unique => true
|
10
|
+
|
11
|
+
create_table :portfolio_entries, :force => true do |t|
|
12
|
+
t.string :title
|
13
|
+
t.text :body
|
14
|
+
t.integer :position
|
15
|
+
t.integer :parent_id
|
16
|
+
t.datetime :created_at
|
17
|
+
t.datetime :updated_at
|
18
|
+
end
|
19
|
+
|
20
|
+
User.find(:all).each do |user|
|
21
|
+
user.plugins.create(:title => "Portfolio", :position => (user.plugins.maximum(:position) || -1) +1)
|
22
|
+
end
|
23
|
+
|
24
|
+
page = Page.create(:title => "Portfolio", :link_url => "/portfolio", :deletable => false, :position => ((Page.maximum(:position, :conditions => "parent_id IS NULL") || -1)+1))
|
25
|
+
RefinerySetting.find_or_set(:default_page_parts, ["body", "side_body"]).each do |default_page_part|
|
26
|
+
page.parts.create(:title => default_page_part, :body => nil)
|
27
|
+
end
|
28
|
+
|
29
|
+
RefinerySetting[:image_thumbnails] = RefinerySetting.find_or_set(:image_thumbnails, {}).merge!({:portfolio_thumb => 'c96x96', :portfolio => '600x512'})
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.down
|
33
|
+
UserPlugin.destroy_all({:title => "Portfolio"})
|
34
|
+
|
35
|
+
Page.find_all_by_link_url("/portfolio").each do |page|
|
36
|
+
page.link_url, page.menu_match, page.deletable = nil
|
37
|
+
page.destroy
|
38
|
+
end
|
39
|
+
Page.destroy_all({:link_url => "/portfolio"})
|
40
|
+
|
41
|
+
RefinerySetting.find_or_set(:image_thumbnails, {}).delete_if {|key, value| key == :portfolio_thumb or key == :portfolio }
|
42
|
+
|
43
|
+
drop_table :images_portfolio_entries
|
44
|
+
drop_table :portfolio_entries
|
45
|
+
end
|
46
|
+
end
|
data/init.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Refinery::Plugin.register do |plugin|
|
2
|
+
plugin.directory = directory
|
3
|
+
plugin.title = "Portfolio"
|
4
|
+
plugin.description = "Manage a portfolio"
|
5
|
+
plugin.version = 1.0
|
6
|
+
plugin.menu_match = /admin\/((portfolio)|(portfolio_entries))/
|
7
|
+
plugin.activity = {
|
8
|
+
:class => PortfolioEntry,
|
9
|
+
:title => 'title',
|
10
|
+
:url_prefix => 'edit',
|
11
|
+
:created_image => "layout_add.png",
|
12
|
+
:updated_image => "layout_edit.png"
|
13
|
+
}
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
namespace :portfolio do
|
2
|
+
desc "Install extra files from the portfolio plugin"
|
3
|
+
|
4
|
+
task :install do
|
5
|
+
plugin_root = File.join(File.dirname(__FILE__), '../../')
|
6
|
+
FileUtils::copy_file File.join(plugin_root, 'db', 'migrate', '20090917224823_create_portfolio_structure.rb'), File.join(RAILS_ROOT, 'db', 'migrate', '20090917224823_create_portfolio_structure.rb')
|
7
|
+
FileUtils::copy_file File.join(plugin_root, 'public', 'stylesheets', 'portfolio.css'), File.join(RAILS_ROOT, 'public', 'stylesheets', 'portfolio.css')
|
8
|
+
FileUtils::copy_file File.join(plugin_root, 'public', 'javascripts', 'portfolio.js'), File.join(RAILS_ROOT, 'public', 'javascripts', 'portfolio.js')
|
9
|
+
puts "Copied database migration, stylesheet and javascript files."
|
10
|
+
puts "Now, run rake db:migrate and then rake images:regenerate"
|
11
|
+
end
|
12
|
+
end
|
data/portfolio.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
|
3
|
+
s.name = %q{portfolio}
|
4
|
+
s.version = "0.9"
|
5
|
+
|
6
|
+
s.authors = ["Resolve Digital", "Philip Arndt"]
|
7
|
+
s.date = %q{2009-10-08}
|
8
|
+
|
9
|
+
s.description = %q{A really straightforward open source Ruby on Rails portfolio plugin designed for integration with RefineryCMS.}
|
10
|
+
s.summary = %q{Ruby on Rails portfolio plugin for RefineryCMS.}
|
11
|
+
|
12
|
+
s.email = %q{info@refinerycms.com}
|
13
|
+
s.extra_rdoc_files = ["README", "CONTRIBUTORS", "LICENSE"]
|
14
|
+
s.files = ["CONTRIBUTORS","LICENSE","README","app","app/controllers","app/controllers/admin","app/controllers/admin/portfolio_entries_controller.rb","app/controllers/portfolio_controller.rb","app/models","app/models/portfolio_entry.rb","app/views","app/views/admin","app/views/admin/portfolio_entries","app/views/admin/portfolio_entries/_form.html.erb","app/views/admin/portfolio_entries/_list.html.erb","app/views/admin/portfolio_entries/_sortable_list.html.erb","app/views/admin/portfolio_entries/edit.html.erb","app/views/admin/portfolio_entries/index.html.erb","app/views/admin/portfolio_entries/new.html.erb","app/views/portfolio","app/views/portfolio/empty.html.erb","app/views/portfolio/show.html.erb","config","config/routes.rb","db","db/migrate","db/migrate/20090917224823_create_portfolio_structure.rb","init.rb","lib","lib/tasks","lib/tasks/tasks.rake","portfolio.gemspec","public","public/javascripts","public/javascripts/portfolio.js","public/stylesheets","public/stylesheets/portfolio.css"]
|
15
|
+
s.homepage = %q{http://refinerycms.com}
|
16
|
+
s.rubygems_version = %q{1.3.4}
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
reset_functionality = function() {
|
2
|
+
Sortable.destroy("portfolio_images");
|
3
|
+
Sortable.create("portfolio_images", {
|
4
|
+
constraint: false
|
5
|
+
, hoverclass: 'hover'
|
6
|
+
, scroll: window
|
7
|
+
, tree: false
|
8
|
+
});
|
9
|
+
|
10
|
+
$$('#portfolio_images li:not([class=empty])').each(function(li) {
|
11
|
+
li.observe('mouseover', function(){
|
12
|
+
image_actions = this.down('.image_actions');
|
13
|
+
if (image_actions == null) {
|
14
|
+
image_actions = new Element("div").addClassName('image_actions');
|
15
|
+
img_delete = new Element("img", {src: '/images/refinery/icons/delete.png', width: 16, height: 16});
|
16
|
+
image_actions.insert(img_delete);
|
17
|
+
img_delete.observe('click', function() {
|
18
|
+
this.up('li').remove();
|
19
|
+
});
|
20
|
+
|
21
|
+
li.insert(image_actions);
|
22
|
+
}
|
23
|
+
|
24
|
+
image_actions.show();
|
25
|
+
});
|
26
|
+
|
27
|
+
li.observe('mouseout', function() {
|
28
|
+
this.down('.image_actions').hide();
|
29
|
+
});
|
30
|
+
});
|
31
|
+
}
|
32
|
+
|
33
|
+
image_added = function() {
|
34
|
+
last_portfolio_entry_image_id = "";
|
35
|
+
$$('li.empty').each(function(empty) {
|
36
|
+
hidden_identifier = empty.down('input[type=hidden]');
|
37
|
+
hidden_identifier.id = '';
|
38
|
+
image_id = hidden_identifier.value;
|
39
|
+
empty.id = 'image_' + image_id;
|
40
|
+
empty.removeClassName('empty');
|
41
|
+
$(empty.down('img')).setStyle({display: ''}).removeAttribute('id');
|
42
|
+
});
|
43
|
+
|
44
|
+
new_list_item = new Element("li").addClassName("empty");
|
45
|
+
img = new Element("img", {id: 'current_portfolio_entry_image', src: '', alt: ''});
|
46
|
+
|
47
|
+
hidden_id = new Element("input", {'type': 'hidden', 'id' : "portfolio_entry_image_id", 'name':'portfolio_entry[image_ids][]'});
|
48
|
+
|
49
|
+
new_list_item.insert(img);
|
50
|
+
new_list_item.insert(hidden_id);
|
51
|
+
$('portfolio_images').insert(new_list_item);
|
52
|
+
reset_functionality();
|
53
|
+
}
|
54
|
+
|
55
|
+
FastInit.addOnLoad(function(){
|
56
|
+
reset_functionality();
|
57
|
+
});
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#body_content.portfolio #body_content_left {
|
2
|
+
width: 621px;
|
3
|
+
margin-right: 39px;
|
4
|
+
}
|
5
|
+
#body_content.portfolio #body_content_left h1 {
|
6
|
+
margin-bottom: 24px;
|
7
|
+
}
|
8
|
+
#body_content.portfolio #body_content_left h1 span {
|
9
|
+
float: left;
|
10
|
+
}
|
11
|
+
#body_content.portfolio #body_content_left h1 select {
|
12
|
+
margin-left: 12px;
|
13
|
+
min-width: 200px;
|
14
|
+
float: right;
|
15
|
+
margin-top: 3px;
|
16
|
+
display: block;
|
17
|
+
}
|
18
|
+
#body_content.portfolio #body_content_right {
|
19
|
+
width: 280px;
|
20
|
+
text-align: left;
|
21
|
+
padding-top: 43px;
|
22
|
+
}
|
23
|
+
#body_content.portfolio #body_content_right h2, #body_content.portfolio #body_content_right {
|
24
|
+
font-size: 15px;
|
25
|
+
font-weight: normal;
|
26
|
+
}
|
27
|
+
|
28
|
+
#portfolio_main_image {
|
29
|
+
border: 3px solid #d4cabc;
|
30
|
+
}
|
31
|
+
#portfolio_images {
|
32
|
+
margin: 0px;
|
33
|
+
padding: 0px;
|
34
|
+
width: 280px;
|
35
|
+
}
|
36
|
+
#portfolio_images li {
|
37
|
+
position: relative;
|
38
|
+
list-style: none;
|
39
|
+
float: left;
|
40
|
+
margin-bottom: 20px;
|
41
|
+
}
|
42
|
+
#portfolio_images li.odd {
|
43
|
+
margin-right: 18px;
|
44
|
+
}
|
45
|
+
|
46
|
+
#portfolio_images.portfolio_entry_images {
|
47
|
+
width: 100%;
|
48
|
+
}
|
49
|
+
#portfolio_images.portfolio_entry_images li {
|
50
|
+
margin-right: 20px;
|
51
|
+
position: relative;
|
52
|
+
margin-bottom: 10px;
|
53
|
+
margin-top: 10px;
|
54
|
+
}
|
55
|
+
#portfolio_images.portfolio_entry_images li .image_actions {
|
56
|
+
background: white;
|
57
|
+
position: absolute;
|
58
|
+
padding: 3px;
|
59
|
+
left: 0px;
|
60
|
+
top: 0px;
|
61
|
+
}
|
62
|
+
#portfolio_images.portfolio_entry_images li * {
|
63
|
+
cursor: pointer;
|
64
|
+
}
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: portfolio
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.9"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Resolve Digital
|
8
|
+
- Philip Arndt
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-10-08 00:00:00 +13:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: A really straightforward open source Ruby on Rails portfolio plugin designed for integration with RefineryCMS.
|
18
|
+
email: info@refinerycms.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files:
|
24
|
+
- README
|
25
|
+
- CONTRIBUTORS
|
26
|
+
- LICENSE
|
27
|
+
files:
|
28
|
+
- CONTRIBUTORS
|
29
|
+
- LICENSE
|
30
|
+
- README
|
31
|
+
- app/controllers/admin/portfolio_entries_controller.rb
|
32
|
+
- app/controllers/portfolio_controller.rb
|
33
|
+
- app/models/portfolio_entry.rb
|
34
|
+
- app/views/admin/portfolio_entries/_form.html.erb
|
35
|
+
- app/views/admin/portfolio_entries/_list.html.erb
|
36
|
+
- app/views/admin/portfolio_entries/_sortable_list.html.erb
|
37
|
+
- app/views/admin/portfolio_entries/edit.html.erb
|
38
|
+
- app/views/admin/portfolio_entries/index.html.erb
|
39
|
+
- app/views/admin/portfolio_entries/new.html.erb
|
40
|
+
- app/views/portfolio/empty.html.erb
|
41
|
+
- app/views/portfolio/show.html.erb
|
42
|
+
- config/routes.rb
|
43
|
+
- db/migrate/20090917224823_create_portfolio_structure.rb
|
44
|
+
- init.rb
|
45
|
+
- lib/tasks/tasks.rake
|
46
|
+
- portfolio.gemspec
|
47
|
+
- public/javascripts/portfolio.js
|
48
|
+
- public/stylesheets/portfolio.css
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://refinerycms.com
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
version:
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.3.5
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: Ruby on Rails portfolio plugin for RefineryCMS.
|
77
|
+
test_files: []
|
78
|
+
|