refinerycms-recommendations 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/refinery/recommendations/admin/recommendations_controller.rb +12 -0
- data/app/controllers/refinery/recommendations/recommendations_controller.rb +34 -0
- data/app/models/refinery/recommendations/recommendation.rb +15 -0
- data/app/views/refinery/recommendations/admin/recommendations/_actions.html.erb +25 -0
- data/app/views/refinery/recommendations/admin/recommendations/_form.html.erb +96 -0
- data/app/views/refinery/recommendations/admin/recommendations/_recommendation.html.erb +20 -0
- data/app/views/refinery/recommendations/admin/recommendations/_recommendations.html.erb +2 -0
- data/app/views/refinery/recommendations/admin/recommendations/_records.html.erb +18 -0
- data/app/views/refinery/recommendations/admin/recommendations/_sortable_list.html.erb +5 -0
- data/app/views/refinery/recommendations/admin/recommendations/edit.html.erb +1 -0
- data/app/views/refinery/recommendations/admin/recommendations/index.html.erb +7 -0
- data/app/views/refinery/recommendations/admin/recommendations/new.html.erb +1 -0
- data/app/views/refinery/recommendations/recommendations/index.html.erb +11 -0
- data/app/views/refinery/recommendations/recommendations/show.html.erb +81 -0
- data/config/locales/en.yml +36 -0
- data/config/locales/es.yml +37 -0
- data/config/locales/fr.yml +36 -0
- data/config/locales/nb.yml +36 -0
- data/config/locales/nl.yml +36 -0
- data/config/routes.rb +19 -0
- data/db/migrate/1_create_recommendations_recommendations.rb +35 -0
- data/db/seeds.rb +23 -0
- data/lib/generators/refinery/recommendations_generator.rb +19 -0
- data/lib/refinery/recommendations.rb +21 -0
- data/lib/refinery/recommendations/engine.rb +27 -0
- data/lib/refinerycms-recommendations.rb +1 -0
- data/lib/tasks/refinery/recommendations.rake +13 -0
- data/readme.md +10 -0
- metadata +105 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Recommendations
|
3
|
+
class RecommendationsController < ::ApplicationController
|
4
|
+
|
5
|
+
before_filter :find_all_recommendations
|
6
|
+
before_filter :find_page
|
7
|
+
|
8
|
+
def index
|
9
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
10
|
+
# by swapping @page for @recommendation in the line below:
|
11
|
+
present(@page)
|
12
|
+
end
|
13
|
+
|
14
|
+
def show
|
15
|
+
@recommendation = Recommendation.find(params[:id])
|
16
|
+
|
17
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
18
|
+
# by swapping @page for @recommendation in the line below:
|
19
|
+
present(@page)
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def find_all_recommendations
|
25
|
+
@recommendations = Recommendation.order('position ASC')
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_page
|
29
|
+
@page = ::Refinery::Page.where(:link_url => "/recommendations").first
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Recommendations
|
3
|
+
class Recommendation < Refinery::Core::BaseModel
|
4
|
+
self.table_name = 'refinery_recommendations'
|
5
|
+
|
6
|
+
attr_accessible :name, :position
|
7
|
+
|
8
|
+
acts_as_indexed :fields => [:name, :company, :company_url, :source_url, :role, :description, :youtube_id]
|
9
|
+
|
10
|
+
validates :name, :presence => true, :uniqueness => true
|
11
|
+
|
12
|
+
belongs_to :photo, :class_name => '::Refinery::Image'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<ul>
|
2
|
+
<% if ::Refinery::Recommendations::Admin::RecommendationsController.searchable? %>
|
3
|
+
<li>
|
4
|
+
<%= render '/refinery/admin/search', :url => refinery.recommendations_admin_recommendations_path %>
|
5
|
+
</li>
|
6
|
+
<% end %>
|
7
|
+
<li>
|
8
|
+
<%= link_to t('.create_new'), refinery.new_recommendations_admin_recommendation_path,
|
9
|
+
:class => "add_icon" %>
|
10
|
+
</li>
|
11
|
+
<% if !searching? && ::Refinery::Recommendations::Admin::RecommendationsController.sortable? && ::Refinery::Recommendations::Recommendation.any? %>
|
12
|
+
<li>
|
13
|
+
<%= link_to t('.reorder', :what => "Recommendations"),
|
14
|
+
refinery.recommendations_admin_recommendations_path,
|
15
|
+
:id => "reorder_action",
|
16
|
+
:class => "reorder_icon" %>
|
17
|
+
|
18
|
+
<%= link_to t('.reorder_done', :what => "Recommendations"),
|
19
|
+
refinery.recommendations_admin_recommendations_path,
|
20
|
+
:id => "reorder_action_done",
|
21
|
+
:style => "display: none;",
|
22
|
+
:class => "reorder_icon" %>
|
23
|
+
</li>
|
24
|
+
<% end %>
|
25
|
+
</ul>
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<%= form_for [refinery, :recommendations_admin, @recommendation] do |f| -%>
|
2
|
+
<%= render '/refinery/admin/error_messages',
|
3
|
+
:object => @recommendation,
|
4
|
+
:include_object_name => true %>
|
5
|
+
|
6
|
+
|
7
|
+
<div class='field'>
|
8
|
+
<%= f.label :name -%>
|
9
|
+
<%= f.text_field :name, :class => 'larger widest' -%>
|
10
|
+
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class='field'>
|
14
|
+
<%= f.label :role -%>
|
15
|
+
<%= f.text_field :role -%>
|
16
|
+
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class='field'>
|
20
|
+
<%= f.label :company -%>
|
21
|
+
<%= f.text_field :company -%>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class='field'>
|
26
|
+
<%= f.label :company_url -%>
|
27
|
+
<%= f.text_field :company_url -%>
|
28
|
+
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class='field'>
|
32
|
+
<%= f.label :source_url -%>
|
33
|
+
<%= f.text_field :source_url -%>
|
34
|
+
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class='field'>
|
38
|
+
<%= f.label :publish_date -%>
|
39
|
+
<%= f.datetime_select :publish_date -%>
|
40
|
+
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div class='field'>
|
44
|
+
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
|
45
|
+
<ul id='page_parts'>
|
46
|
+
<% [:description].each_with_index do |part, part_index| %>
|
47
|
+
<li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
|
48
|
+
<%= link_to t("#{part}", :scope => "activerecord.attributes.refinery/recommendations/recommendation", :default => part.to_s.titleize), "##{part}" %>
|
49
|
+
</li>
|
50
|
+
<% end %>
|
51
|
+
</ul>
|
52
|
+
<div id='page_part_editors'>
|
53
|
+
<% [:description].each do |part| %>
|
54
|
+
<div class='page_part' id='<%= part %>'>
|
55
|
+
<%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
|
56
|
+
</div>
|
57
|
+
<% end %>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<div class='field'>
|
64
|
+
<%= f.label :youtube_id -%>
|
65
|
+
<%= f.text_field :youtube_id -%>
|
66
|
+
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<div class='field'>
|
70
|
+
<%= f.label :photo -%>
|
71
|
+
<%= render '/refinery/admin/image_picker',
|
72
|
+
:f => f,
|
73
|
+
:field => :photo_id,
|
74
|
+
:image => @recommendation.photo,
|
75
|
+
:toggle_image_display => false %>
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div class='field'>
|
80
|
+
<%= f.label :widget_visible -%>
|
81
|
+
<%= f.check_box :widget_visible, :checked => @recommendation[:widget_visible] -%>
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<%= render '/refinery/admin/form_actions', :f => f,
|
86
|
+
:continue_editing => false,
|
87
|
+
:delete_title => t('delete', :scope => 'refinery.recommendations.admin.recommendations.recommendation'),
|
88
|
+
:delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @recommendation.name) %>
|
89
|
+
<% end -%>
|
90
|
+
<% content_for :javascripts do %>
|
91
|
+
<script>
|
92
|
+
$(document).ready(function(){
|
93
|
+
page_options.init(false, '', '');
|
94
|
+
});
|
95
|
+
</script>
|
96
|
+
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(recommendation) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= recommendation.name %>
|
4
|
+
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
|
8
|
+
<%= link_to refinery_icon_tag("application_go.png"), refinery.recommendations_recommendation_path(recommendation),
|
9
|
+
:title => t('.view_live_html'),
|
10
|
+
:target => "_blank" %>
|
11
|
+
|
12
|
+
<%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_recommendations_admin_recommendation_path(recommendation),
|
13
|
+
:title => t('.edit') %>
|
14
|
+
<%= link_to refinery_icon_tag("delete.png"), refinery.recommendations_admin_recommendation_path(recommendation),
|
15
|
+
:class => "cancel confirm-delete",
|
16
|
+
:title => t('.delete'),
|
17
|
+
:confirm => t('message', :scope => 'refinery.admin.delete', :title => recommendation.name),
|
18
|
+
:method => :delete %>
|
19
|
+
</span>
|
20
|
+
</li>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% if searching? %>
|
2
|
+
<h2><%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %></h2>
|
3
|
+
<% end %>
|
4
|
+
<div class='pagination_container'>
|
5
|
+
<% if @recommendations.any? %>
|
6
|
+
<%= render 'recommendations' %>
|
7
|
+
<% else %>
|
8
|
+
<p>
|
9
|
+
<% unless searching? %>
|
10
|
+
<strong>
|
11
|
+
<%= t('.no_items_yet') %>
|
12
|
+
</strong>
|
13
|
+
<% else %>
|
14
|
+
<%= t('no_results', :scope => 'refinery.admin.search') %>
|
15
|
+
<% end %>
|
16
|
+
</p>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<section id='records'>
|
2
|
+
<%= render 'records' %>
|
3
|
+
</section>
|
4
|
+
<aside id='actions'>
|
5
|
+
<%= render 'actions' %>
|
6
|
+
</aside>
|
7
|
+
<%= render '/refinery/admin/make_sortable', :tree => false if !searching? and ::Refinery::Recommendations::Admin::RecommendationsController.sortable? and ::Refinery::Recommendations::Recommendation.count > 1 %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% content_for :body_content_left do %>
|
2
|
+
<ul id="recommendations">
|
3
|
+
<% @recommendations.each do |recommendation| %>
|
4
|
+
<li>
|
5
|
+
<%= link_to recommendation.name, refinery.recommendations_recommendation_path(recommendation) %>
|
6
|
+
</li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= render '/refinery/content_page' %>
|
@@ -0,0 +1,81 @@
|
|
1
|
+
<% content_for :body_content_title do %>
|
2
|
+
<%= @recommendation.name %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :body_content_left do %>
|
6
|
+
<section>
|
7
|
+
<h1>Name</h1>
|
8
|
+
<p>
|
9
|
+
<%=raw @recommendation.name %>
|
10
|
+
</p>
|
11
|
+
</section>
|
12
|
+
<section>
|
13
|
+
<h1>Role</h1>
|
14
|
+
<p>
|
15
|
+
<%=raw @recommendation.role %>
|
16
|
+
</p>
|
17
|
+
</section>
|
18
|
+
<section>
|
19
|
+
<h1>Company</h1>
|
20
|
+
<p>
|
21
|
+
<%=raw @recommendation.company %>
|
22
|
+
</p>
|
23
|
+
</section>
|
24
|
+
<section>
|
25
|
+
<h1>Company Url</h1>
|
26
|
+
<p>
|
27
|
+
<%=raw @recommendation.company_url %>
|
28
|
+
</p>
|
29
|
+
</section>
|
30
|
+
<section>
|
31
|
+
<h1>Source Url</h1>
|
32
|
+
<p>
|
33
|
+
<%=raw @recommendation.source_url %>
|
34
|
+
</p>
|
35
|
+
</section>
|
36
|
+
<section>
|
37
|
+
<h1>Publish Date</h1>
|
38
|
+
<p>
|
39
|
+
<%=raw @recommendation.publish_date %>
|
40
|
+
</p>
|
41
|
+
</section>
|
42
|
+
<section>
|
43
|
+
<h1>Description</h1>
|
44
|
+
<p>
|
45
|
+
<%=raw @recommendation.description %>
|
46
|
+
</p>
|
47
|
+
</section>
|
48
|
+
<section>
|
49
|
+
<h1>Youtube</h1>
|
50
|
+
<p>
|
51
|
+
<%=raw @recommendation.youtube_id %>
|
52
|
+
</p>
|
53
|
+
</section>
|
54
|
+
<section>
|
55
|
+
<h1>Photo</h1>
|
56
|
+
<p>
|
57
|
+
<%= image_fu @recommendation.photo, nil %>
|
58
|
+
</p>
|
59
|
+
</section>
|
60
|
+
<section>
|
61
|
+
<h1>Widget Visible</h1>
|
62
|
+
<p>
|
63
|
+
<%=raw @recommendation.widget_visible %>
|
64
|
+
</p>
|
65
|
+
</section>
|
66
|
+
<% end %>
|
67
|
+
|
68
|
+
<% content_for :body_content_right do %>
|
69
|
+
<aside>
|
70
|
+
<h2><%= t('.other') %></h2>
|
71
|
+
<ul id="recommendations">
|
72
|
+
<% @recommendations.each do |recommendation| %>
|
73
|
+
<li>
|
74
|
+
<%= link_to recommendation.name, refinery.recommendations_recommendation_path(recommendation) %>
|
75
|
+
</li>
|
76
|
+
<% end %>
|
77
|
+
</ul>
|
78
|
+
</aside>
|
79
|
+
<% end %>
|
80
|
+
|
81
|
+
<%= render '/refinery/content_page' %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
en:
|
2
|
+
refinery:
|
3
|
+
plugins:
|
4
|
+
recommendations:
|
5
|
+
title: Recommendations
|
6
|
+
recommendations:
|
7
|
+
admin:
|
8
|
+
recommendations:
|
9
|
+
actions:
|
10
|
+
create_new: Add New Recommendation
|
11
|
+
reorder: Reorder Recommendations
|
12
|
+
reorder_done: Done Reordering Recommendations
|
13
|
+
records:
|
14
|
+
title: Recommendations
|
15
|
+
sorry_no_results: Sorry! There are no results found.
|
16
|
+
no_items_yet: There are no Recommendations yet. Click "Add New Recommendation" to add your first recommendation.
|
17
|
+
recommendation:
|
18
|
+
view_live_html: View this recommendation live <br/><em>(opens in a new window)</em>
|
19
|
+
edit: Edit this recommendation
|
20
|
+
delete: Remove this recommendation forever
|
21
|
+
recommendations:
|
22
|
+
show:
|
23
|
+
other: Other Recommendations
|
24
|
+
activerecord:
|
25
|
+
attributes:
|
26
|
+
'refinery/recommendations/recommendation':
|
27
|
+
name: Name
|
28
|
+
company: Company
|
29
|
+
company_url: Company Url
|
30
|
+
source_url: Source Url
|
31
|
+
publish_date: Publish Date
|
32
|
+
role: Role
|
33
|
+
description: Description
|
34
|
+
youtube_id: Youtube
|
35
|
+
photo: Photo
|
36
|
+
widget_visible: Widget Visible
|
@@ -0,0 +1,37 @@
|
|
1
|
+
es:
|
2
|
+
refinery:
|
3
|
+
plugins:
|
4
|
+
recommendations:
|
5
|
+
title: Recommendations
|
6
|
+
# article: masculino/femenino
|
7
|
+
recommendations:
|
8
|
+
admin:
|
9
|
+
recommendations:
|
10
|
+
actions:
|
11
|
+
create_new: Crear nuevo recommendation
|
12
|
+
reorder: Reordenar recommendations
|
13
|
+
reorder_done: Reordenación de recommendations completada
|
14
|
+
records:
|
15
|
+
title: Recommendations
|
16
|
+
sorry_no_results: Lo siento, no hay resultados
|
17
|
+
no_items_yet: No hay recommendations todavía. Pulsa en "Crear nuevo Recommendation" para crear tu primer recommendation.
|
18
|
+
recommendation:
|
19
|
+
view_live_html: Ver este recommendation como abierto al público <br/><em>(abre en ventana nueva)</em>
|
20
|
+
edit: Editar este recommendation
|
21
|
+
delete: Borrar este recommendation para siempre
|
22
|
+
recommendations:
|
23
|
+
show:
|
24
|
+
other: Otros recommendations
|
25
|
+
activerecord:
|
26
|
+
attributes:
|
27
|
+
'refinery/recommendations/recommendation':
|
28
|
+
name: Name
|
29
|
+
company: Company
|
30
|
+
company_url: Company Url
|
31
|
+
source_url: Source Url
|
32
|
+
publish_date: Publish Date
|
33
|
+
role: Role
|
34
|
+
description: Description
|
35
|
+
youtube_id: Youtube
|
36
|
+
photo: Photo
|
37
|
+
widget_visible: Widget Visible
|
@@ -0,0 +1,36 @@
|
|
1
|
+
fr:
|
2
|
+
refinery:
|
3
|
+
plugins:
|
4
|
+
recommendations:
|
5
|
+
title: Recommendations
|
6
|
+
recommendations:
|
7
|
+
admin:
|
8
|
+
recommendations:
|
9
|
+
actions:
|
10
|
+
create_new: Créer un(e) nouve(au/l/lle) Recommendation
|
11
|
+
reorder: Réordonner les Recommendations
|
12
|
+
reorder_done: Fin de réordonnancement des Recommendations
|
13
|
+
records:
|
14
|
+
title: Recommendations
|
15
|
+
sorry_no_results: "Désolé ! Aucun résultat."
|
16
|
+
no_items_yet: 'Il n''y a actuellement aucun(e) Recommendation. Cliquer sur "Créer un(e) nouve(au/l/lle) Recommendation" pour créer votre premi(er/ère) recommendation.'
|
17
|
+
recommendation:
|
18
|
+
view_live_html: Voir ce(t/tte) recommendation <br/><em>(Ouvre une nouvelle fenêtre)</em>
|
19
|
+
edit: Modifier ce(t/tte) recommendation
|
20
|
+
delete: Supprimer définitivement ce(t/tte) recommendation
|
21
|
+
recommendations:
|
22
|
+
show:
|
23
|
+
other: Autres Recommendations
|
24
|
+
activerecord:
|
25
|
+
attributes:
|
26
|
+
'refinery/recommendations/recommendation':
|
27
|
+
name: Name
|
28
|
+
company: Company
|
29
|
+
company_url: Company Url
|
30
|
+
source_url: Source Url
|
31
|
+
publish_date: Publish Date
|
32
|
+
role: Role
|
33
|
+
description: Description
|
34
|
+
youtube_id: Youtube
|
35
|
+
photo: Photo
|
36
|
+
widget_visible: Widget Visible
|
@@ -0,0 +1,36 @@
|
|
1
|
+
nb:
|
2
|
+
refinery:
|
3
|
+
plugins:
|
4
|
+
recommendations:
|
5
|
+
title: Recommendations
|
6
|
+
recommendations:
|
7
|
+
admin:
|
8
|
+
recommendations:
|
9
|
+
actions:
|
10
|
+
create_new: Lag en ny Recommendation
|
11
|
+
reorder: Endre rekkefølgen på Recommendations
|
12
|
+
reorder_done: Ferdig å endre rekkefølgen Recommendations
|
13
|
+
records:
|
14
|
+
title: Recommendations
|
15
|
+
sorry_no_results: Beklager! Vi fant ikke noen resultater.
|
16
|
+
no_items_yet: Det er ingen Recommendations enda. Klikk på "Lag en ny Recommendation" for å legge til din første recommendation.
|
17
|
+
recommendation:
|
18
|
+
view_live_html: Vis hvordan denne recommendation ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
|
19
|
+
edit: Rediger denne recommendation
|
20
|
+
delete: Fjern denne recommendation permanent
|
21
|
+
recommendations:
|
22
|
+
show:
|
23
|
+
other: Andre Recommendations
|
24
|
+
activerecord:
|
25
|
+
attributes:
|
26
|
+
'refinery/recommendations/recommendation':
|
27
|
+
name: Name
|
28
|
+
company: Company
|
29
|
+
company_url: Company Url
|
30
|
+
source_url: Source Url
|
31
|
+
publish_date: Publish Date
|
32
|
+
role: Role
|
33
|
+
description: Description
|
34
|
+
youtube_id: Youtube
|
35
|
+
photo: Photo
|
36
|
+
widget_visible: Widget Visible
|
@@ -0,0 +1,36 @@
|
|
1
|
+
nl:
|
2
|
+
refinery:
|
3
|
+
plugins:
|
4
|
+
recommendations:
|
5
|
+
title: Recommendations
|
6
|
+
recommendations:
|
7
|
+
admin:
|
8
|
+
recommendations:
|
9
|
+
actions:
|
10
|
+
create_new: Maak een nieuwe Recommendation
|
11
|
+
reorder: Wijzig de volgorde van de Recommendations
|
12
|
+
reorder_done: Klaar met het wijzingen van de volgorde van de Recommendations
|
13
|
+
records:
|
14
|
+
title: Recommendations
|
15
|
+
sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
|
16
|
+
no_items_yet: Er zijn nog geen Recommendations. Druk op 'Maak een nieuwe Recommendation' om de eerste aan te maken.
|
17
|
+
recommendation:
|
18
|
+
view_live_html: Bekijk deze recommendation op de website <br/><em>(opent een nieuw venster)</em>
|
19
|
+
edit: Bewerk deze recommendation
|
20
|
+
delete: Verwijder deze recommendation voor eeuwig
|
21
|
+
recommendations:
|
22
|
+
show:
|
23
|
+
other: Andere Recommendations
|
24
|
+
activerecord:
|
25
|
+
attributes:
|
26
|
+
'refinery/recommendations/recommendation':
|
27
|
+
name: Name
|
28
|
+
company: Company
|
29
|
+
company_url: Company Url
|
30
|
+
source_url: Source Url
|
31
|
+
publish_date: Publish Date
|
32
|
+
role: Role
|
33
|
+
description: Description
|
34
|
+
youtube_id: Youtube
|
35
|
+
photo: Photo
|
36
|
+
widget_visible: Widget Visible
|
data/config/routes.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Refinery::Core::Engine.routes.append do
|
2
|
+
|
3
|
+
# Frontend routes
|
4
|
+
namespace :recommendations do
|
5
|
+
resources :recommendations, :path => '', :only => [:index, :show]
|
6
|
+
end
|
7
|
+
|
8
|
+
# Admin routes
|
9
|
+
namespace :recommendations, :path => '' do
|
10
|
+
namespace :admin, :path => 'refinery' do
|
11
|
+
resources :recommendations, :except => :show do
|
12
|
+
collection do
|
13
|
+
post :update_positions
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class CreateRecommendationsRecommendations < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def up
|
4
|
+
create_table :refinery_recommendations do |t|
|
5
|
+
t.string :name
|
6
|
+
t.string :role
|
7
|
+
t.string :company
|
8
|
+
t.string :company_url
|
9
|
+
t.string :source_url
|
10
|
+
t.datetime :publish_date
|
11
|
+
t.text :description
|
12
|
+
t.string :youtube_id
|
13
|
+
t.integer :photo_id
|
14
|
+
t.boolean :widget_visible
|
15
|
+
t.integer :position
|
16
|
+
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def down
|
23
|
+
if defined?(::Refinery::UserPlugin)
|
24
|
+
::Refinery::UserPlugin.destroy_all({:name => "refinerycms-recommendations"})
|
25
|
+
end
|
26
|
+
|
27
|
+
if defined?(::Refinery::Page)
|
28
|
+
::Refinery::Page.delete_all({:link_url => "/recommendations/recommendations"})
|
29
|
+
end
|
30
|
+
|
31
|
+
drop_table :refinery_recommendations
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
if defined?(::Refinery::User)
|
2
|
+
::Refinery::User.all.each do |user|
|
3
|
+
if user.plugins.where(:name => 'refinerycms-recommendations').blank?
|
4
|
+
user.plugins.create(:name => 'refinerycms-recommendations',
|
5
|
+
:position => (user.plugins.maximum(:position) || -1) +1)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
url = "/recommendations"
|
12
|
+
if defined?(::Refinery::Page) && ::Refinery::Page.where(:link_url => url).empty?
|
13
|
+
page = ::Refinery::Page.create(
|
14
|
+
:title => 'Recommendations',
|
15
|
+
:link_url => url,
|
16
|
+
:deletable => false,
|
17
|
+
:menu_match => "^#{url}(\/|\/.+?|)$"
|
18
|
+
)
|
19
|
+
Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
|
20
|
+
page.parts.create(:title => default_page_part, :body => nil, :position => index)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Refinery
|
2
|
+
class RecommendationsGenerator < Rails::Generators::Base
|
3
|
+
|
4
|
+
def rake_db
|
5
|
+
rake("refinery_recommendations:install:migrations")
|
6
|
+
end
|
7
|
+
|
8
|
+
def append_load_seed_data
|
9
|
+
create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
|
10
|
+
append_file 'db/seeds.rb', :verbose => true do
|
11
|
+
<<-EOH
|
12
|
+
|
13
|
+
# Added by Refinery CMS Recommendations extension
|
14
|
+
Refinery::Recommendations::Engine.load_seed
|
15
|
+
EOH
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'refinerycms-core'
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
autoload :RecommendationsGenerator, 'generators/refinery/recommendations_generator'
|
5
|
+
|
6
|
+
module Recommendations
|
7
|
+
require 'refinery/recommendations/engine'
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_writer :root
|
11
|
+
|
12
|
+
def root
|
13
|
+
@root ||= Pathname.new(File.expand_path('../../../', __FILE__))
|
14
|
+
end
|
15
|
+
|
16
|
+
def factory_paths
|
17
|
+
@factory_paths ||= [ root.join('spec', 'factories').to_s ]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Recommendations
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
include Refinery::Engine
|
5
|
+
isolate_namespace Refinery::Recommendations
|
6
|
+
|
7
|
+
engine_name :refinery_recommendations
|
8
|
+
|
9
|
+
initializer "register refinerycms_recommendations plugin" do
|
10
|
+
Refinery::Plugin.register do |plugin|
|
11
|
+
plugin.name = "recommendations"
|
12
|
+
plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.recommendations_admin_recommendations_path }
|
13
|
+
plugin.pathname = root
|
14
|
+
plugin.activity = {
|
15
|
+
:class_name => :'refinery/recommendations/recommendation',
|
16
|
+
:title => 'name'
|
17
|
+
}
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
config.after_initialize do
|
23
|
+
Refinery.register_extension(Refinery::Recommendations)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'refinery/recommendations'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
namespace :refinery do
|
2
|
+
|
3
|
+
namespace :recommendations do
|
4
|
+
|
5
|
+
# call this task by running: rake refinery:recommendations:my_task
|
6
|
+
# desc "Description of my task below"
|
7
|
+
# task :my_task => :environment do
|
8
|
+
# # add your logic here
|
9
|
+
# end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Recommendations extension for Refinery CMS.
|
2
|
+
|
3
|
+
## How to build this extension as a gem
|
4
|
+
|
5
|
+
cd vendor/extensions/recommendations
|
6
|
+
gem build refinerycms-recommendations.gemspec
|
7
|
+
gem install refinerycms-recommendations.gem
|
8
|
+
|
9
|
+
# Sign up for a http://rubygems.org/ account and publish the gem
|
10
|
+
gem push refinerycms-recommendations.gem
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: refinerycms-recommendations
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Rich Larcombe
|
9
|
+
- Ben Bruscella
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-06-10 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: refinerycms-core
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.0.4
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 2.0.4
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: refinerycms-testing
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 2.0.4
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.0.4
|
47
|
+
description: Ruby on Rails Recommendations extension for Refinery CMS
|
48
|
+
email: rich@logicbox.com.au
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- app/controllers/refinery/recommendations/admin/recommendations_controller.rb
|
54
|
+
- app/controllers/refinery/recommendations/recommendations_controller.rb
|
55
|
+
- app/models/refinery/recommendations/recommendation.rb
|
56
|
+
- app/views/refinery/recommendations/admin/recommendations/_actions.html.erb
|
57
|
+
- app/views/refinery/recommendations/admin/recommendations/_form.html.erb
|
58
|
+
- app/views/refinery/recommendations/admin/recommendations/_recommendation.html.erb
|
59
|
+
- app/views/refinery/recommendations/admin/recommendations/_recommendations.html.erb
|
60
|
+
- app/views/refinery/recommendations/admin/recommendations/_records.html.erb
|
61
|
+
- app/views/refinery/recommendations/admin/recommendations/_sortable_list.html.erb
|
62
|
+
- app/views/refinery/recommendations/admin/recommendations/edit.html.erb
|
63
|
+
- app/views/refinery/recommendations/admin/recommendations/index.html.erb
|
64
|
+
- app/views/refinery/recommendations/admin/recommendations/new.html.erb
|
65
|
+
- app/views/refinery/recommendations/recommendations/index.html.erb
|
66
|
+
- app/views/refinery/recommendations/recommendations/show.html.erb
|
67
|
+
- config/locales/en.yml
|
68
|
+
- config/locales/es.yml
|
69
|
+
- config/locales/fr.yml
|
70
|
+
- config/locales/nb.yml
|
71
|
+
- config/locales/nl.yml
|
72
|
+
- config/routes.rb
|
73
|
+
- db/migrate/1_create_recommendations_recommendations.rb
|
74
|
+
- db/seeds.rb
|
75
|
+
- lib/generators/refinery/recommendations_generator.rb
|
76
|
+
- lib/refinery/recommendations/engine.rb
|
77
|
+
- lib/refinery/recommendations.rb
|
78
|
+
- lib/refinerycms-recommendations.rb
|
79
|
+
- lib/tasks/refinery/recommendations.rake
|
80
|
+
- readme.md
|
81
|
+
homepage: https://github.com/thelogicbox/refinerycms-recommendations
|
82
|
+
licenses: []
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 1.8.24
|
102
|
+
signing_key:
|
103
|
+
specification_version: 3
|
104
|
+
summary: Recommendations extension for Refinery CMS
|
105
|
+
test_files: []
|