portfolio 0.9.1.8 → 0.9.2

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.
@@ -1,11 +1,11 @@
1
1
  class PortfolioController < ApplicationController
2
-
2
+
3
3
  before_filter :load_page, :only => [:index, :show, :empty]
4
-
4
+
5
5
  def index
6
6
  redirect_to portfolio_url(PortfolioEntry.find_by_parent_id(nil, :order => "position ASC")) rescue error_404
7
7
  end
8
-
8
+
9
9
  def show
10
10
  begin
11
11
  if params[:id]
@@ -13,13 +13,13 @@ class PortfolioController < ApplicationController
13
13
  else
14
14
  @master_entry = PortfolioEntry.find_by_parent_id(nil, :order => "position ASC")
15
15
  end
16
-
16
+
17
17
  if params[:portfolio_id]
18
18
  @portfolio_entry = @master_entry.children.find(params[:portfolio_id])
19
19
  else
20
20
  @portfolio_entry = @master_entry.children.first
21
21
  end
22
-
22
+
23
23
  begin
24
24
  if params[:image_id]
25
25
  @image = @portfolio_entry.images[params[:image_id].to_i]
@@ -32,12 +32,14 @@ class PortfolioController < ApplicationController
32
32
  rescue
33
33
  error_404
34
34
  end
35
+
36
+ render :partial => "main_image", :layout => false if request.xhr?
35
37
  end
36
-
38
+
37
39
  protected
38
40
 
39
41
  def load_page
40
- @page = Page.find_by_link_url('/portfolio', :include => [:parts])
42
+ @page = Page.find_by_link_url('/portfolio', :include => [:parts])
41
43
  end
42
-
44
+
43
45
  end
@@ -0,0 +1 @@
1
+ <%= image_fu @image, :portfolio, :id => "portfolio_main_image" unless @image.nil? %>
@@ -4,7 +4,7 @@
4
4
  <div id='body_content_left' class='clearfix'>
5
5
  <h1><%= @master_entry.title %></h1>
6
6
  <p>
7
- <em>We haven't entered anything in for this project yet.</em>
7
+ <em><%= t(:portfolio_no_entries, :default => "We haven't entered anything in for this project yet.") %></em>
8
8
  </p>
9
9
  </div>
10
10
  </div>
@@ -6,8 +6,8 @@
6
6
  <span><%= @master_entry.title %></span>
7
7
  <%= select :portfolio_entry, :to_param, @master_entry.children.collect{|entry| [entry.title, entry.to_param] } %>
8
8
  </h1>
9
-
10
- <%= image_fu @image, :portfolio, :id => "portfolio_main_image" unless @image.nil? %>
9
+
10
+ <%= render :partial => "main_image" %>
11
11
  </div>
12
12
  <div id='body_content_right' class='clearfix'>
13
13
  <h2><%= @portfolio_entry.title %></h2>
@@ -15,9 +15,8 @@
15
15
  <% (images = @portfolio_entry.images).each do |image| %>
16
16
  <li class='<%= cycle("odd", "even") %>'>
17
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)) %>
18
+ <%= link_to image_fu(image, :portfolio_thumb),
19
+ portfolio_image_url(@master_entry, @portfolio_entry, images.index(image)), :class => className %>
21
20
  </li>
22
21
  <% end %>
23
22
  </ul>
@@ -26,16 +25,35 @@
26
25
  <% content_for :head do %>
27
26
  <%# remove these javascript_include_tag calls if they are included in your layout.
28
27
  %>
29
- <%= javascript_include_tag 'prototype', 'fastinit' %>
28
+ <%= javascript_include_tag 'jquery' %>
30
29
  <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){
30
+ $(document).ready(function(){
31
+ $("ul#portfolio_images li a.pale img").fadeTo(0, 0.3);
32
+
33
+ $('#portfolio_entry_to_param').change(function() {
37
34
  window.location = "<%= portfolio_project_url(@master_entry, nil) %>" + this.value;
38
35
  });
36
+
37
+ var clicked_on = null;
38
+ $("ul#portfolio_images li a").click(function(event) {
39
+ if (!$(this).hasClass('selected')) {
40
+ clicked_on = $(this);
41
+ $.get($(this).attr('href'), function(data, textStatus) {
42
+ if (textStatus == "success") {
43
+ $('#portfolio_main_image').before(data).remove();
44
+
45
+ $('ul#portfolio_images li a.selected').removeClass('selected').addClass('pale');
46
+
47
+ clicked_on.removeClass('pale').addClass('selected');
48
+ clicked_on.find('img').fadeTo(0, 1);
49
+
50
+ $("ul#portfolio_images li a.pale img").fadeTo(0, 0.3);
51
+ }
52
+ });
53
+ }
54
+
55
+ return false;
56
+ });
39
57
  });
40
58
  </script>
41
59
  <% end %>
File without changes
@@ -3,13 +3,13 @@ Refinery::Plugin.register do |plugin|
3
3
  plugin.title = "Portfolio"
4
4
  plugin.description = "Manage a portfolio"
5
5
  plugin.url = "/admin/#{plugin.title.downcase}"
6
- plugin.version = '0.9.1.5'
6
+ plugin.version = '0.9.1.8'
7
7
  plugin.menu_match = /admin\/((portfolio)|(portfolio_entries))/
8
8
  plugin.activity = {
9
9
  :class => PortfolioEntry,
10
- :title => 'title',
11
- :url_prefix => 'edit',
12
- :created_image => "layout_add.png",
10
+ :title => 'title',
11
+ :url_prefix => 'edit',
12
+ :created_image => "layout_add.png",
13
13
  :updated_image => "layout_edit.png"
14
14
  }
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portfolio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1.8
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Resolve Digital
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-21 00:00:00 +13:00
13
+ date: 2010-01-19 00:00:00 +13:00
14
14
  default_executable: portfolio-install
15
15
  dependencies: []
16
16
 
@@ -37,6 +37,7 @@ files:
37
37
  - app/views/admin/portfolio_entries/edit.html.erb
38
38
  - app/views/admin/portfolio_entries/index.html.erb
39
39
  - app/views/admin/portfolio_entries/new.html.erb
40
+ - app/views/portfolio/_main_image.html.erb
40
41
  - app/views/portfolio/empty.html.erb
41
42
  - app/views/portfolio/show.html.erb
42
43
  - bin/portfolio-install