refinerycms-menus 0.0.1 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/menus_controller.rb +7 -0
- data/app/controllers/menus_controller.rb +30 -0
- data/app/models/menu.rb +10 -0
- data/app/views/admin/menus/_form.html.erb +19 -0
- data/app/views/admin/menus/_menu.html.erb +20 -0
- data/app/views/admin/menus/_sortable_list.html.erb +4 -0
- data/app/views/admin/menus/edit.html.erb +1 -0
- data/app/views/admin/menus/index.html.erb +67 -0
- data/app/views/admin/menus/new.html.erb +1 -0
- data/app/views/menus/index.html.erb +11 -0
- data/app/views/menus/show.html.erb +25 -0
- data/config/locales/en.yml +23 -0
- data/config/locales/nb.yml +19 -0
- data/config/locales/nl.yml +19 -0
- data/config/routes.rb +11 -0
- data/lib/generators/refinerycms_menus_generator.rb +6 -0
- data/lib/menus.rb +20 -0
- data/lib/tasks/menus.rake +13 -0
- metadata +59 -40
- data/README.md +0 -4
- data/Rakefile +0 -0
- data/lib/refinerycms-menus.rb +0 -1
- data/refinerycms-menus.gemspec +0 -19
@@ -0,0 +1,30 @@
|
|
1
|
+
class MenusController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :find_all_menus
|
4
|
+
before_filter :find_page
|
5
|
+
|
6
|
+
def index
|
7
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
8
|
+
# by swapping @page for @menu in the line below:
|
9
|
+
present(@page)
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
@menu = Menu.find(params[:id])
|
14
|
+
|
15
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
16
|
+
# by swapping @page for @menu in the line below:
|
17
|
+
present(@page)
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def find_all_menus
|
23
|
+
@menus = Menu.find(:all, :order => "position ASC")
|
24
|
+
end
|
25
|
+
|
26
|
+
def find_page
|
27
|
+
@page = Page.find_by_link_url("/menus")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/app/models/menu.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<% form_for [:admin, @menu] do |f| -%>
|
2
|
+
<%= render :partial => "/shared/admin/error_messages", :locals => {
|
3
|
+
:object => @menu,
|
4
|
+
:include_object_name => true
|
5
|
+
} %>
|
6
|
+
|
7
|
+
<div class='field'>
|
8
|
+
<%= f.label :name -%>
|
9
|
+
<%= f.text_field :name, :class => 'larger widest' -%>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<%= render :partial => "/shared/admin/form_actions",
|
13
|
+
:locals => {
|
14
|
+
:f => f,
|
15
|
+
:continue_editing => false,
|
16
|
+
:delete_title => t('admin.menus.menu.delete'),
|
17
|
+
:delete_confirmation => t('shared.admin.delete.message', :title => @menu.name)
|
18
|
+
} %>
|
19
|
+
<% end -%>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(menu) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= menu.name %>
|
4
|
+
<span class="preview"> </span>
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
<%= link_to refinery_icon_tag("application_go.png"), menu_url(menu),
|
8
|
+
:title => t('.view_live'),
|
9
|
+
:target => "_blank" %>
|
10
|
+
<%= link_to refinery_icon_tag("application_edit.png"), edit_admin_menu_path(menu),
|
11
|
+
:title => t('.edit') %>
|
12
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_menu_path(menu),
|
13
|
+
:class => "cancel confirm-delete",
|
14
|
+
:title => t('.delete'),
|
15
|
+
:'data-confirm' => t('shared.admin.delete.message',
|
16
|
+
:title => menu.name
|
17
|
+
),
|
18
|
+
:'data-method' => :delete %>
|
19
|
+
</span>
|
20
|
+
</li>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<ul>
|
3
|
+
<% if Admin::MenusController.searchable? %>
|
4
|
+
<li>
|
5
|
+
<%= render :partial => "/shared/admin/search",
|
6
|
+
:locals => {
|
7
|
+
:url => admin_menus_url
|
8
|
+
} %>
|
9
|
+
</li>
|
10
|
+
<% end %>
|
11
|
+
<li>
|
12
|
+
<%= link_to t('.create_new'), new_admin_menu_url,
|
13
|
+
:class => "add_icon" %>
|
14
|
+
</li>
|
15
|
+
<% if !searching? and Menu.count > 1 and Admin::MenusController.sortable? %>
|
16
|
+
<li>
|
17
|
+
<%= link_to t('.reorder', :what => "Menus"),
|
18
|
+
admin_menus_url,
|
19
|
+
:id => "reorder_action",
|
20
|
+
:class => "reorder_icon" %>
|
21
|
+
|
22
|
+
<%= link_to t('.reorder_done', :what => "Menus"),
|
23
|
+
admin_menus_url,
|
24
|
+
:id => "reorder_action_done",
|
25
|
+
:style => "display: none;",
|
26
|
+
:class => "reorder_icon" %>
|
27
|
+
</li>
|
28
|
+
<% end %>
|
29
|
+
</ul>
|
30
|
+
</div>
|
31
|
+
<div id='records'>
|
32
|
+
<% if searching? %>
|
33
|
+
<h2><%= t('shared.admin.search.results_for', :query => params[:search]) %></h2>
|
34
|
+
<% if @menus.any? %>
|
35
|
+
<%= will_paginate @menus, :previous_label => '«', :next_label => '»' %>
|
36
|
+
<ul>
|
37
|
+
<%= render :partial => "menu",
|
38
|
+
:collection => @menus %>
|
39
|
+
</ul>
|
40
|
+
<%= will_paginate @menus, :previous_label => '«', :next_label => '»' %>
|
41
|
+
<% else %>
|
42
|
+
<p><%= t('shared.admin.search.no_results') %></p>
|
43
|
+
<% end %>
|
44
|
+
<% else %>
|
45
|
+
<% if @menus.any? %>
|
46
|
+
<%= will_paginate @menus,
|
47
|
+
:previous_label => '«',
|
48
|
+
:next_label => '»' %>
|
49
|
+
|
50
|
+
<%= render :partial => "sortable_list" %>
|
51
|
+
|
52
|
+
<%= will_paginate @menus,
|
53
|
+
:previous_label => '«',
|
54
|
+
:next_label => '»' %>
|
55
|
+
<% else %>
|
56
|
+
<p>
|
57
|
+
<strong>
|
58
|
+
<%= t('.no_items_yet') %>
|
59
|
+
</strong>
|
60
|
+
</p>
|
61
|
+
<% end %>
|
62
|
+
<% end %>
|
63
|
+
</div>
|
64
|
+
<%= render :partial => "/shared/admin/make_sortable",
|
65
|
+
:locals => {
|
66
|
+
:tree => false
|
67
|
+
} if !searching? and Menu.count > 1 %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<% content_for :body_content_title do %>
|
2
|
+
<%= @menu.name %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :body_content_left do %>
|
6
|
+
|
7
|
+
<div>
|
8
|
+
<h3>Name</h3>
|
9
|
+
<%=raw @menu.name %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% content_for :body_content_right do %>
|
15
|
+
<h2><%= t('.other') %></h2>
|
16
|
+
<ul id="menus">
|
17
|
+
<% @menus.each do |menu| %>
|
18
|
+
<li>
|
19
|
+
<%= link_to menu.name, menu_url(menu) %>
|
20
|
+
</li>
|
21
|
+
<% end %>
|
22
|
+
</ul>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
en:
|
2
|
+
shared:
|
3
|
+
admin:
|
4
|
+
image_picker:
|
5
|
+
image: image
|
6
|
+
plugins:
|
7
|
+
menus:
|
8
|
+
title: Menus
|
9
|
+
admin:
|
10
|
+
menus:
|
11
|
+
index:
|
12
|
+
create_new: Create a new Menu
|
13
|
+
reorder: Reorder Menus
|
14
|
+
reorder_done: Done Reordering Menus
|
15
|
+
sorry_no_results: Sorry! There are no results found.
|
16
|
+
no_items_yet: There are no Menus yet. Click "Create a new Menu" to add your first menu.
|
17
|
+
menu:
|
18
|
+
view_live: View this menu live <br/><em>(opens in a new window)</em>
|
19
|
+
edit: Edit this menu
|
20
|
+
delete: Remove this menu forever
|
21
|
+
menus:
|
22
|
+
show:
|
23
|
+
other: Other Menus
|
@@ -0,0 +1,19 @@
|
|
1
|
+
nb:
|
2
|
+
plugins:
|
3
|
+
menus:
|
4
|
+
title: Menus
|
5
|
+
admin:
|
6
|
+
menus:
|
7
|
+
index:
|
8
|
+
create_new: Lag en ny Menu
|
9
|
+
reorder: Endre rekkefølgen på Menus
|
10
|
+
reorder_done: Ferdig å endre rekkefølgen Menus
|
11
|
+
sorry_no_results: Beklager! Vi fant ikke noen resultater.
|
12
|
+
no_items_yet: Det er ingen Menus enda. Klikk på "Lag en ny Menu" for å legge til din første menu.
|
13
|
+
menu:
|
14
|
+
view_live: Vis hvordan denne menu ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
|
15
|
+
edit: Rediger denne menu
|
16
|
+
delete: Fjern denne menu permanent
|
17
|
+
menus:
|
18
|
+
show:
|
19
|
+
other: Andre Menus
|
@@ -0,0 +1,19 @@
|
|
1
|
+
nl:
|
2
|
+
plugins:
|
3
|
+
menus:
|
4
|
+
title: Menus
|
5
|
+
admin:
|
6
|
+
menus:
|
7
|
+
index:
|
8
|
+
create_new: Maak een nieuwe Menu
|
9
|
+
reorder: Wijzig de volgorde van de Menus
|
10
|
+
reorder_done: Klaar met het wijzingen van de volgorde van de Menus
|
11
|
+
sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
|
12
|
+
no_items_yet: Er zijn nog geen Menus. Druk op 'Maak een nieuwe Menu' om de eerste aan te maken.
|
13
|
+
menu:
|
14
|
+
view_live: Bekijk deze menu op de website <br/><em>(opent een nieuw venster)</em>
|
15
|
+
edit: Bewerk deze menu
|
16
|
+
delete: Verwijder deze menu voor eeuwig
|
17
|
+
menus:
|
18
|
+
show:
|
19
|
+
other: Andere Menus
|
data/config/routes.rb
ADDED
data/lib/menus.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'refinery'
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Menus
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
initializer "static assets" do |app|
|
7
|
+
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
8
|
+
end
|
9
|
+
|
10
|
+
config.after_initialize do
|
11
|
+
Refinery::Plugin.register do |plugin|
|
12
|
+
plugin.name = "menus"
|
13
|
+
plugin.activity = {:class => Menu,
|
14
|
+
:title => 'name'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,61 +1,80 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-menus
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
version: "1.0"
|
6
9
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
9
|
-
- Rob Yurkowski
|
10
|
+
authors: []
|
11
|
+
|
10
12
|
autorequire:
|
11
13
|
bindir: bin
|
12
14
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
requirements:
|
20
|
-
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 2.1.0.dev
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: *70363137856440
|
26
|
-
description: Ruby on Rails Menus extension for Refinery CMS
|
15
|
+
|
16
|
+
date: 2010-12-25 00:00:00 -05:00
|
17
|
+
default_executable:
|
18
|
+
dependencies: []
|
19
|
+
|
20
|
+
description: Ruby on Rails Menus engine for Refinery CMS
|
27
21
|
email:
|
28
22
|
executables: []
|
23
|
+
|
29
24
|
extensions: []
|
25
|
+
|
30
26
|
extra_rdoc_files: []
|
31
|
-
|
32
|
-
|
33
|
-
-
|
34
|
-
- lib/
|
35
|
-
-
|
27
|
+
|
28
|
+
files:
|
29
|
+
- lib/generators/refinerycms_menus_generator.rb
|
30
|
+
- lib/menus.rb
|
31
|
+
- lib/tasks/menus.rake
|
32
|
+
- config/locales/en.yml
|
33
|
+
- config/locales/nb.yml
|
34
|
+
- config/locales/nl.yml
|
35
|
+
- config/routes.rb
|
36
|
+
- app/controllers/admin/menus_controller.rb
|
37
|
+
- app/controllers/menus_controller.rb
|
38
|
+
- app/models/menu.rb
|
39
|
+
- app/views/admin/menus/_form.html.erb
|
40
|
+
- app/views/admin/menus/_menu.html.erb
|
41
|
+
- app/views/admin/menus/_sortable_list.html.erb
|
42
|
+
- app/views/admin/menus/edit.html.erb
|
43
|
+
- app/views/admin/menus/index.html.erb
|
44
|
+
- app/views/admin/menus/new.html.erb
|
45
|
+
- app/views/menus/index.html.erb
|
46
|
+
- app/views/menus/show.html.erb
|
47
|
+
has_rdoc: true
|
36
48
|
homepage:
|
37
49
|
licenses: []
|
50
|
+
|
38
51
|
post_install_message:
|
39
52
|
rdoc_options: []
|
40
|
-
|
53
|
+
|
54
|
+
require_paths:
|
41
55
|
- lib
|
42
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
57
|
none: false
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
|
48
|
-
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
65
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
54
72
|
requirements: []
|
73
|
+
|
55
74
|
rubyforge_project:
|
56
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.3.7
|
57
76
|
signing_key:
|
58
77
|
specification_version: 3
|
59
|
-
summary: Menus
|
78
|
+
summary: Ruby on Rails Menus engine for Refinery CMS
|
60
79
|
test_files: []
|
61
|
-
|
80
|
+
|
data/README.md
DELETED
data/Rakefile
DELETED
File without changes
|
data/lib/refinerycms-menus.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Code here.
|
data/refinerycms-menus.gemspec
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# Encoding: UTF-8
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.platform = Gem::Platform::RUBY
|
5
|
-
s.name = 'refinerycms-menus'
|
6
|
-
s.version = '0.0.1'
|
7
|
-
s.description = 'Ruby on Rails Menus extension for Refinery CMS'
|
8
|
-
s.date = '2012-07-04'
|
9
|
-
s.summary = 'Menus extension for Refinery CMS'
|
10
|
-
s.authors = ['Amanda Wagener', 'Rob Yurkowski']
|
11
|
-
s.require_paths = %w(lib)
|
12
|
-
s.files = `git ls-files`.split("\n")
|
13
|
-
|
14
|
-
# Runtime dependencies
|
15
|
-
s.add_dependency 'refinerycms-core', '~> 2.1.0.dev'
|
16
|
-
|
17
|
-
# Development dependencies (usually used for testing)
|
18
|
-
# s.add_development_dependency 'refinerycms-testing', '~> 2.1.0.dev'
|
19
|
-
end
|