refinerycms-menus 0.0.1 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ class Admin::MenusController < Admin::BaseController
2
+
3
+ crudify :menu,
4
+ :title_attribute => 'name'
5
+
6
+
7
+ end
@@ -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
@@ -0,0 +1,10 @@
1
+ class Menu < ActiveRecord::Base
2
+
3
+ acts_as_indexed :fields => [:name]
4
+
5
+ validates_presence_of :name
6
+ validates_uniqueness_of :name
7
+
8
+
9
+
10
+ end
@@ -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">&nbsp;</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,4 @@
1
+ <ul id='sortable_list'>
2
+ <%= render :partial => 'menu', :collection => @menus %>
3
+ </ul>
4
+ <%= render :partial => "/shared/admin/sortable_list", :locals => {:continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)} %>
@@ -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 => '&laquo;', :next_label => '&raquo;' %>
36
+ <ul>
37
+ <%= render :partial => "menu",
38
+ :collection => @menus %>
39
+ </ul>
40
+ <%= will_paginate @menus, :previous_label => '&laquo;', :next_label => '&raquo;' %>
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 => '&laquo;',
48
+ :next_label => '&raquo;' %>
49
+
50
+ <%= render :partial => "sortable_list" %>
51
+
52
+ <%= will_paginate @menus,
53
+ :previous_label => '&laquo;',
54
+ :next_label => '&raquo;' %>
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,11 @@
1
+ <% content_for :body_content_left do %>
2
+ <ul id="menus">
3
+ <% @menus.each do |menu| %>
4
+ <li>
5
+ <%= link_to menu.name, menu_url(menu) %>
6
+ </li>
7
+ <% end %>
8
+ </ul>
9
+ <% end %>
10
+
11
+ <%= render :partial => "/shared/content_page" %>
@@ -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
@@ -0,0 +1,11 @@
1
+ Refinery::Application.routes.draw do
2
+ resources :menus
3
+
4
+ scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
5
+ resources :menus do
6
+ collection do
7
+ post :update_positions
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class RefinerycmsMenus < Refinery::Generators::EngineInstaller
2
+
3
+ source_root File.expand_path('../../', __FILE__)
4
+ engine_name "menus"
5
+
6
+ end
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
@@ -0,0 +1,13 @@
1
+ namespace :refinery do
2
+
3
+ namespace :menus do
4
+
5
+ # call this task my running: rake refinery:menus: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
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
- version: 0.0.1
5
- prerelease:
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
- - Amanda Wagener
9
- - Rob Yurkowski
10
+ authors: []
11
+
10
12
  autorequire:
11
13
  bindir: bin
12
14
  cert_chain: []
13
- date: 2012-07-04 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: refinerycms-core
17
- requirement: &70363137856440 !ruby/object:Gem::Requirement
18
- none: false
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
- files:
32
- - README.md
33
- - Rakefile
34
- - lib/refinerycms-menus.rb
35
- - refinerycms-menus.gemspec
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
- require_paths:
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
- version: '0'
48
- required_rubygems_version: !ruby/object:Gem::Requirement
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
- version: '0'
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.8.15
75
+ rubygems_version: 1.3.7
57
76
  signing_key:
58
77
  specification_version: 3
59
- summary: Menus extension for Refinery CMS
78
+ summary: Ruby on Rails Menus engine for Refinery CMS
60
79
  test_files: []
61
- has_rdoc:
80
+
data/README.md DELETED
@@ -1,4 +0,0 @@
1
- refinerycms-menus
2
- =================
3
-
4
- A menu extension for RefineryCMS
data/Rakefile DELETED
File without changes
@@ -1 +0,0 @@
1
- # Code here.
@@ -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