refinerycms-project_portfolios 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/app/controllers/admin/project_portfolios_controller.rb +8 -0
  2. data/app/controllers/project_portfolios_controller.rb +33 -0
  3. data/app/helpers/project_portfolio_helper.rb +17 -0
  4. data/app/models/project_portfolio.rb +12 -0
  5. data/app/views/admin/project_portfolios/_actions.html.erb +28 -0
  6. data/app/views/admin/project_portfolios/_form.html.erb +86 -0
  7. data/app/views/admin/project_portfolios/_project_portfolio.html.erb +18 -0
  8. data/app/views/admin/project_portfolios/_project_portfolios.html.erb +2 -0
  9. data/app/views/admin/project_portfolios/_records.html.erb +18 -0
  10. data/app/views/admin/project_portfolios/_sortable_list.html.erb +7 -0
  11. data/app/views/admin/project_portfolios/edit.html.erb +1 -0
  12. data/app/views/admin/project_portfolios/index.html.erb +10 -0
  13. data/app/views/admin/project_portfolios/new.html.erb +1 -0
  14. data/app/views/project_portfolios/_popup_portfolio.html.erb +14 -0
  15. data/app/views/project_portfolios/index.html.erb +68 -0
  16. data/app/views/project_portfolios/show.html.erb +51 -0
  17. data/config/locales/en.yml +25 -0
  18. data/config/locales/fr.yml +25 -0
  19. data/config/locales/lolcat.yml +25 -0
  20. data/config/locales/nb.yml +21 -0
  21. data/config/locales/nl.yml +21 -0
  22. data/config/routes.rb +11 -0
  23. data/db/migrate/create_project_portfolios.rb +34 -0
  24. data/db/seeds/project_portfolios.rb +21 -0
  25. data/lib/generators/refinerycms_project_portfolios_generator.rb +6 -0
  26. data/lib/refinerycms-project_portfolios.rb +30 -0
  27. data/lib/tasks/project_portfolios.rake +13 -0
  28. data/public/images/close_yellow_icon.png +0 -0
  29. data/public/javascripts/jquery.bpopup.js +10 -0
  30. data/public/javascripts/jquery.easing.js +205 -0
  31. data/public/javascripts/jquery.quicksand.js +307 -0
  32. data/public/stylesheets/portfolio.css +130 -0
  33. metadata +125 -0
@@ -0,0 +1,8 @@
1
+ module Admin
2
+ class ProjectPortfoliosController < Admin::BaseController
3
+
4
+ crudify :project_portfolio,
5
+ :title_attribute => 'project_name', :xhr_paging => true
6
+
7
+ end
8
+ end
@@ -0,0 +1,33 @@
1
+ class ProjectPortfoliosController < ApplicationController
2
+
3
+ before_filter :find_all_project_portfolios
4
+ before_filter :find_page
5
+ helper :project_portfolio
6
+
7
+ def index
8
+ # you can use meta fields from your model instead (e.g. browser_title)
9
+ # by swapping @page for @project_portfolio in the line below:
10
+ #present(@page)
11
+ @portfolios = ProjectPortfolio.all
12
+ @tags = ProjectPortfolio.tag_counts_on(:tags)
13
+ end
14
+
15
+ def show
16
+ @project_portfolio = ProjectPortfolio.find(params[:id])
17
+
18
+ # you can use meta fields from your model instead (e.g. browser_title)
19
+ # by swapping @page for @project_portfolio in the line below:
20
+ present(@page)
21
+ end
22
+
23
+ protected
24
+
25
+ def find_all_project_portfolios
26
+ @project_portfolios = ProjectPortfolio.order('position ASC')
27
+ end
28
+
29
+ def find_page
30
+ @page = Page.where(:link_url => "/project_portfolios").first
31
+ end
32
+
33
+ end
@@ -0,0 +1,17 @@
1
+ module ProjectPortfolioHelper
2
+ def render_thumbnail(portfolio)
3
+ if portfolio.thumbnail_url.blank?
4
+ image_fu portfolio.thumbnail, nil
5
+ else
6
+ image_tag(portfolio.thumbnail_url)
7
+ end
8
+ end
9
+
10
+ def render_image(portfolio)
11
+ if portfolio.image_url.blank?
12
+ image_fu portfolio.image, :width => '400'
13
+ elsif portfolio.image_url.present?
14
+ image_tag(portfolio.image_url, :width => '400')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ class ProjectPortfolio < ActiveRecord::Base
2
+
3
+ acts_as_indexed :fields => [:project_name, :title]
4
+
5
+ validates :project_name, :presence => true, :uniqueness => true
6
+
7
+ belongs_to :thumbnail, :class_name => 'Image'
8
+ belongs_to :image, :class_name => 'Image'
9
+
10
+ acts_as_taggable
11
+
12
+ end
@@ -0,0 +1,28 @@
1
+ <ul>
2
+ <% if Admin::ProjectPortfoliosController.searchable? %>
3
+ <li>
4
+ <%= render :partial => "/shared/admin/search",
5
+ :locals => {
6
+ :url => admin_project_portfolios_path
7
+ } %>
8
+ </li>
9
+ <% end %>
10
+ <li>
11
+ <%= link_to t('.create_new'), new_admin_project_portfolio_path,
12
+ :class => "add_icon" %>
13
+ </li>
14
+ <% if !searching? and Admin::ProjectPortfoliosController.sortable? and ProjectPortfolio.count > 1 %>
15
+ <li>
16
+ <%= link_to t('.reorder', :what => "Project Portfolios"),
17
+ admin_project_portfolios_path,
18
+ :id => "reorder_action",
19
+ :class => "reorder_icon" %>
20
+
21
+ <%= link_to t('.reorder_done', :what => "Project Portfolios"),
22
+ admin_project_portfolios_path,
23
+ :id => "reorder_action_done",
24
+ :style => "display: none;",
25
+ :class => "reorder_icon" %>
26
+ </li>
27
+ <% end %>
28
+ </ul>
@@ -0,0 +1,86 @@
1
+ <%= form_for [:admin, @project_portfolio] do |f| -%>
2
+ <%= render :partial => "/shared/admin/error_messages", :locals => {
3
+ :object => @project_portfolio,
4
+ :include_object_name => true
5
+ } %>
6
+
7
+ <div class='field'>
8
+ <%= f.label :project_name -%>
9
+ <%= f.text_field :project_name, :class => 'larger widest' -%>
10
+ </div>
11
+
12
+ <div class='field'>
13
+ <%= f.label :title -%>
14
+ <%= f.text_field :title -%>
15
+ </div>
16
+
17
+ <div class='field'>
18
+ <%= f.label :thumbnail -%>
19
+ <%= render :partial => "/shared/admin/image_picker", :locals => {
20
+ :f => f,
21
+ :field => :thumbnail_id,
22
+ :image => @project_portfolio.thumbnail,
23
+ :toggle_image_display => false
24
+ } %>
25
+ </div>
26
+ OR
27
+ <div class='field'>
28
+ <%= f.label :thumbnail_url -%>
29
+ <%= f.text_field :thumbnail_url -%>
30
+ </div>
31
+
32
+ <div class='field'>
33
+ <%= f.label :image -%>
34
+ <%= render :partial => "/shared/admin/image_picker", :locals => {
35
+ :f => f,
36
+ :field => :image_id,
37
+ :image => @project_portfolio.image,
38
+ :toggle_image_display => false
39
+ } %>
40
+ </div>
41
+ OR
42
+ <div class='field'>
43
+ <%= f.label :image_url -%>
44
+ <%= f.text_field :image_url -%>
45
+ </div>
46
+
47
+ <div class='field'>
48
+ <%= f.label :tag_list -%>
49
+ <%= f.text_field :tag_list -%>
50
+ </div>
51
+
52
+ <div class='field'>
53
+ <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
54
+ <ul id='page_parts'>
55
+ <% [:description].each_with_index do |part, part_index| %>
56
+ <li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
57
+ <%= link_to part.to_s.titleize, "##{part}" %>
58
+ </li>
59
+ <% end %>
60
+ </ul>
61
+
62
+ <div id='page_part_editors'>
63
+ <% [:description].each do |part| %>
64
+ <div class='page_part' id='<%= part %>'>
65
+ <%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
66
+ </div>
67
+ <% end %>
68
+ </div>
69
+ </div>
70
+ </div>
71
+
72
+ <%= render :partial => "/shared/admin/form_actions",
73
+ :locals => {
74
+ :f => f,
75
+ :continue_editing => false,
76
+ :delete_title => t('delete', :scope => 'admin.project_portfolios.project_portfolio'),
77
+ :delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @project_portfolio.project_name)
78
+ } %>
79
+ <% end -%>
80
+ <% content_for :javascripts do %>
81
+ <script>
82
+ $(document).ready(function(){
83
+ page_options.init(false, '', '');
84
+ });
85
+ </script>
86
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(project_portfolio) -%>">
2
+ <span class='title'>
3
+ <%= project_portfolio.project_name %>
4
+ <span class="preview">&nbsp;</span>
5
+ </span>
6
+ <span class='actions'>
7
+ <%= link_to refinery_icon_tag("application_go.png"), project_portfolio_path(project_portfolio),
8
+ :title => t('.view_live_html'),
9
+ :target => "_blank" %>
10
+ <%= link_to refinery_icon_tag("application_edit.png"), edit_admin_project_portfolio_path(project_portfolio),
11
+ :title => t('.edit') %>
12
+ <%= link_to refinery_icon_tag("delete.png"), admin_project_portfolio_path(project_portfolio),
13
+ :class => "cancel confirm-delete",
14
+ :title => t('.delete'),
15
+ :confirm => t('message', :scope => 'shared.admin.delete', :title => project_portfolio.project_name),
16
+ :method => :delete %>
17
+ </span>
18
+ </li>
@@ -0,0 +1,2 @@
1
+ <%= will_paginate @project_portfolios %>
2
+ <%= render :partial => "sortable_list" %>
@@ -0,0 +1,18 @@
1
+ <% if searching? %>
2
+ <h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
3
+ <% end %>
4
+ <% if @project_portfolios.any? %>
5
+ <div class='pagination_container'>
6
+ <%= render :partial => 'project_portfolios' %>
7
+ </div>
8
+ <% else %>
9
+ <p>
10
+ <% unless searching? %>
11
+ <strong>
12
+ <%= t('.no_items_yet') %>
13
+ </strong>
14
+ <% else %>
15
+ <%= t('no_results', :scope => 'shared.admin.search') %>
16
+ <% end %>
17
+ </p>
18
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <ul id='sortable_list'>
2
+ <%= render :partial => 'project_portfolio', :collection => @project_portfolios %>
3
+ </ul>
4
+ <%= render :partial => "/shared/admin/sortable_list",
5
+ :locals => {
6
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true
7
+ } %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,10 @@
1
+ <section id='records'>
2
+ <%= render :partial => 'records' %>
3
+ </section>
4
+ <aside id='actions'>
5
+ <%= render :partial => 'actions' %>
6
+ </aside>
7
+ <%= render :partial => '/shared/admin/make_sortable',
8
+ :locals => {
9
+ :tree => false
10
+ } if !searching? and Admin::ProjectPortfoliosController.sortable? and ProjectPortfolio.count > 1 %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,14 @@
1
+ <div class="popup" style="display: none;" id="popup_content<%= portfolio.id %>">
2
+ <div class="title">
3
+ <h2><%= portfolio.project_name %><span style="float: right;" class="bClose close_icon"></span></h2>
4
+ </div>
5
+ <div class="content" style="clear: both;">
6
+ <h3><%= portfolio.title %></h3>
7
+ <div style="float: left;" width="400">
8
+ <%= render_image portfolio %>
9
+ </div>
10
+ <div>
11
+ <%= portfolio.description.html_safe %>
12
+ </div>
13
+ </div>
14
+ </div>
@@ -0,0 +1,68 @@
1
+ <% content_for :head do %>
2
+ <%= javascript_include_tag 'jquery.quicksand.js' %>
3
+ <%= javascript_include_tag 'jquery.easing.js' %>
4
+ <%= javascript_include_tag 'jquery.bpopup.js' %>
5
+ <link href="stylesheets/portfolio.css" media="screen" rel="stylesheet" type="text/css" />
6
+ <script type="text/javascript">
7
+ function attatch_all_popup() {
8
+ $('#portfolios a').click(function() {
9
+ var element_id = $(this).attr("popup-id");
10
+ $('#popup_content'+ element_id).openPopup({amsl:50, fadeSpeed:500, opacity:0.8});
11
+ return false;
12
+ });
13
+ }
14
+
15
+ $(document).ready(function(){
16
+ attatch_all_popup();
17
+ });
18
+
19
+ $(function() {
20
+ var projects = $('#portfolios');
21
+ var projectsClone = projects.clone();
22
+ $('#tags a').click(function() {
23
+ $('#tags label').removeClass("active");
24
+ var tag = $(this).html();
25
+ $(this).parent().addClass("active");
26
+ if(tag == 'all') {
27
+ var filteredProjects = projectsClone.find('li');
28
+ } else {
29
+ var filteredProjects = projectsClone.find('li[data-type*=' + tag + ']');
30
+ }
31
+ projects.quicksand(filteredProjects, {
32
+ duration : 800,
33
+ easing : 'easeInOutQuad'
34
+ }, function() { // when done shuffling
35
+ attatch_all_popup();
36
+ });
37
+ });
38
+ });
39
+
40
+ </script>
41
+ <% end %>
42
+
43
+ <% content_for :body_content_left do %>
44
+ <div>
45
+ <div id="tags">
46
+ <label class="button active"><a href="#">all</a></label>
47
+ <% @tags.each do |tag| %>
48
+ <label class="button"><a href="#"><%= tag.name %> </a></label>
49
+ <% end %>
50
+ </div>
51
+ </div>
52
+ <ul id="portfolios" class="image-grid">
53
+ <% @portfolios.each do |portfolio| %>
54
+ <li class="box" data-id="id-<%= portfolio.id %>" data-type="<%= portfolio.tag_list %>">
55
+ <a popup-id="<%= portfolio.id %>" href="#">
56
+ <%= render_thumbnail portfolio %>
57
+ <strong><%= portfolio.project_name %></strong>
58
+ </a>
59
+ </li>
60
+ <% end %>
61
+ </ul>
62
+ <% end %>
63
+
64
+ <%= render :partial => "/shared/content_page" %>
65
+
66
+ <% @portfolios.each do |portfolio| %>
67
+ <%= render :partial => 'popup_portfolio', :locals => {:portfolio => portfolio} %>
68
+ <% end %>
@@ -0,0 +1,51 @@
1
+ <% content_for :body_content_title do %>
2
+ <%= @project_portfolio.project_name %>
3
+ <% end %>
4
+
5
+ <% content_for :body_content_left do %>
6
+ <section>
7
+ <h1>Project Name</h1>
8
+ <p>
9
+ <%=raw @project_portfolio.project_name %>
10
+ </p>
11
+ </section>
12
+ <section>
13
+ <h1>Title</h1>
14
+ <p>
15
+ <%=raw @project_portfolio.title %>
16
+ </p>
17
+ </section>
18
+ <section>
19
+ <h1>Thumbnail</h1>
20
+ <p>
21
+ <%= render_thumbnail @project_portfolio %>
22
+ </p>
23
+ </section>
24
+ <section>
25
+ <h1>Tags</h1>
26
+ <p>
27
+ <%= @project_portfolio.tag_list %>
28
+ </p>
29
+ </section>
30
+ <section>
31
+ <h1>Description</h1>
32
+ <p>
33
+ <%=raw @project_portfolio.description %>
34
+ </p>
35
+ </section>
36
+ <% end %>
37
+
38
+ <% content_for :body_content_right do %>
39
+ <aside>
40
+ <h2><%= t('.other') %></h2>
41
+ <ul id="project_portfolios">
42
+ <% @project_portfolios.each do |project_portfolio| %>
43
+ <li>
44
+ <%= link_to project_portfolio.project_name, project_portfolio_path(project_portfolio) %>
45
+ </li>
46
+ <% end %>
47
+ </ul>
48
+ </aside>
49
+ <% end %>
50
+
51
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,25 @@
1
+ en:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: image
6
+ plugins:
7
+ project_portfolios:
8
+ title: Project Portfolios
9
+ admin:
10
+ project_portfolios:
11
+ actions:
12
+ create_new: Add New Project Portfolio
13
+ reorder: Reorder Project Portfolios
14
+ reorder_done: Done Reordering Project Portfolios
15
+ records:
16
+ title: Project Portfolios
17
+ sorry_no_results: Sorry! There are no results found.
18
+ no_items_yet: There are no Project Portfolios yet. Click "Add New Project Portfolio" to add your first project portfolio.
19
+ project_portfolio:
20
+ view_live_html: View this project portfolio live <br/><em>(opens in a new window)</em>
21
+ edit: Edit this project portfolio
22
+ delete: Remove this project portfolio forever
23
+ project_portfolios:
24
+ show:
25
+ other: Other Project Portfolios
@@ -0,0 +1,25 @@
1
+ fr:
2
+ shared:
3
+ admin:
4
+ image_picker:
5
+ image: image
6
+ plugins:
7
+ project_portfolios:
8
+ title: Project Portfolios
9
+ admin:
10
+ project_portfolios:
11
+ actions:
12
+ create_new: Créer un(e) nouve(au/l/lle) Project Portfolio
13
+ reorder: Réordonner les Project Portfolios
14
+ reorder_done: Fin de réordonnancement des Project Portfolios
15
+ records:
16
+ title: Project Portfolios
17
+ sorry_no_results: "Désolé ! Aucun résultat."
18
+ no_items_yet: 'Il n''y a actuellement aucun(e) Project Portfolio. Cliquer sur "Créer un(e) nouve(au/l/lle) Project Portfolio" pour créer votre premi(er/ère) project portfolio.'
19
+ project_portfolio:
20
+ view_live_html: Voir ce(t/tte) project portfolio <br/><em>(Ouvre une nouvelle fenêtre)</em>
21
+ edit: Modifier ce(t/tte) project portfolio
22
+ delete: Supprimer définitivement ce(t/tte) project portfolio
23
+ project_portfolios:
24
+ show:
25
+ other: Autres Project Portfolios