merb-words 0.1
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.
- data/LICENSE +20 -0
- data/README +59 -0
- data/Rakefile +68 -0
- data/app/controllers/application.rb +5 -0
- data/app/controllers/categories.rb +52 -0
- data/app/controllers/pages.rb +109 -0
- data/app/controllers/passwords.rb +89 -0
- data/app/helpers/application_helper.rb +55 -0
- data/app/helpers/global_helpers.rb +7 -0
- data/app/models/category.rb +10 -0
- data/app/models/order.rb +9 -0
- data/app/models/page.rb +14 -0
- data/app/models/password.rb +25 -0
- data/app/views/categories/_form.html.erb +3 -0
- data/app/views/categories/create.html.erb +8 -0
- data/app/views/categories/delete.html.erb +8 -0
- data/app/views/categories/update.html.erb +8 -0
- data/app/views/layout/application.xml.erb +8 -0
- data/app/views/pages/_category.html.erb +41 -0
- data/app/views/pages/_form.html.erb +29 -0
- data/app/views/pages/_order.html.erb +17 -0
- data/app/views/pages/_page.html.erb +26 -0
- data/app/views/pages/_preview.html.erb +14 -0
- data/app/views/pages/_search.html.erb +21 -0
- data/app/views/pages/create.html.erb +8 -0
- data/app/views/pages/delete.html.erb +6 -0
- data/app/views/pages/feed.xml.erb +7 -0
- data/app/views/pages/index.html.erb +34 -0
- data/app/views/pages/read.html.erb +19 -0
- data/app/views/pages/update.html.erb +8 -0
- data/app/views/passwords/_form.html.erb +12 -0
- data/app/views/passwords/create.html.erb +8 -0
- data/app/views/passwords/delete.html.erb +6 -0
- data/app/views/passwords/read.html.erb +10 -0
- data/app/views/passwords/update.html.erb +9 -0
- data/lib/merb-words/merbtasks.rb +103 -0
- data/lib/merb-words/slicetasks.rb +18 -0
- data/lib/merb-words/spectasks.rb +65 -0
- data/lib/merb-words.rb +107 -0
- metadata +120 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
<%= mui_grid(:cell_valign => 'bottom', :columns => 3) do %>
|
2
|
+
<%= mui_cell(:width => '100%') do %>
|
3
|
+
<%= mui_block do %>
|
4
|
+
<%= mui_link(:title => page.title, :title_size => '1.5em', :url => slice_url(:read, :page_id => page.id)) %>
|
5
|
+
<% end =%>
|
6
|
+
<% end =%>
|
7
|
+
<%= mui_cell(:wrap => false) do %>
|
8
|
+
<%= mui_block do %>
|
9
|
+
<%= mui_date_span(:created => page.created_at, :updated => page.updated_at) %>
|
10
|
+
<% end =%>
|
11
|
+
<% end =%>
|
12
|
+
<% if merb_words_password? %>
|
13
|
+
<%= mui_cell(:wrap => false) do %>
|
14
|
+
<%= mui_block do %>
|
15
|
+
<% if page.publish == false %>
|
16
|
+
<i>unpublished</i>
|
17
|
+
<% end %>
|
18
|
+
<%= mui_button(:title => 'Update', :url => slice_url(:update, :page_id => page.id), :window => 'open') %>
|
19
|
+
<%= mui_button(:title => '×', :tone => 'negative', :url => slice_url(:delete, :page_id => page.id), :window => 'open') %>
|
20
|
+
<% end =%>
|
21
|
+
<% end =%>
|
22
|
+
<% end %>
|
23
|
+
<% end =%>
|
24
|
+
<%= mui_block do %>
|
25
|
+
<%= merb_words_truncate(:body => page.body) %>
|
26
|
+
<% end =%>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= mui_block do %>
|
2
|
+
<%= mui_page_truncate(:body => page.body) %>
|
3
|
+
<% end =%>
|
4
|
+
<%= mui_grid(:columns => 2, :width => '100%') do %>
|
5
|
+
<%= mui_cell do %>
|
6
|
+
<%= mui_button(:title => 'Read →', :tone => 'positive', :url => slice_url(:read, :page_id => page.id)) %>
|
7
|
+
<% end =%>
|
8
|
+
<% if mui_password? %>
|
9
|
+
<%= mui_cell(:align => 'right') do %>
|
10
|
+
<%= mui_button(:title => 'Update', :url => slice_url(:update, :page_id => page.id), :window => 'open') %>
|
11
|
+
<%= mui_button(:title => 'Delete', :tone => 'negative', :url => slice_url(:delete, :page_id => page.id), :window => 'open') %>
|
12
|
+
<% end =%>
|
13
|
+
<% end %>
|
14
|
+
<% end =%>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%
|
2
|
+
attributes = {}
|
3
|
+
attributes[:order_property] = params[:order_property]
|
4
|
+
%>
|
5
|
+
<%= mui_block do %>
|
6
|
+
<%= mui_search(:action => slice_url(:index, attributes), :width => '10em') %>
|
7
|
+
<% end =%>
|
8
|
+
<% if searches = session[:mui_searches] %>
|
9
|
+
<% searches.each do |search| %>
|
10
|
+
<% attributes[:search] = CGI.unescape(search) %>
|
11
|
+
<%= mui_grid(:columns => 2, :width => '100%') do %>
|
12
|
+
<%= mui_cell do %>
|
13
|
+
<%= mui_link(:title => CGI.unescape(search), :title_size => '0.85em', :url => slice_url(:index, attributes)) %>
|
14
|
+
<% end =%>
|
15
|
+
<%= mui_cell(:align => 'right', :wrap => false) do %>
|
16
|
+
|
17
|
+
<%= mui_button(:title => '×', :tone => 'negative', :url => slice_url(:search_delete, :search => search)) %>
|
18
|
+
<% end =%>
|
19
|
+
<% end =%>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= mui_window(:title => 'Create Page') do %>
|
2
|
+
<%= mui_form(:page, :action => slice_url(:create)) do %>
|
3
|
+
<%= partial(:form) %>
|
4
|
+
<%= mui_block do %>
|
5
|
+
<%= mui_button(:title => 'Create', :submit => true, :tone => 'positive')%>
|
6
|
+
<% end =%>
|
7
|
+
<% end =%>
|
8
|
+
<% end =%>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= mui_window(:title => 'Delete Page') do %>
|
2
|
+
<%= mui_block do %>Are you sure that you want to delete <%= @page.title %>?<% end =%>
|
3
|
+
<%= mui_block do %>
|
4
|
+
<%= mui_delete(:title => 'Delete', :url => slice_url(:delete, :page_id => @page.id)) %>
|
5
|
+
<% end =%>
|
6
|
+
<% end =%>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%= merb_words_password_status %>
|
2
|
+
<%= mui_grid(:columns => 2, :width => '100%') do %>
|
3
|
+
<%= mui_cell(:width => '75%') do %>
|
4
|
+
<%= mui_grid(:cell_valign => 'bottom', :columns => 2) do %>
|
5
|
+
<%= mui_cell(:width => '100%') do %>
|
6
|
+
<%= mui_block(:title => merb_words_title, :title_size => '3em')%>
|
7
|
+
<% end =%>
|
8
|
+
<% if merb_words_password? %>
|
9
|
+
<%= mui_cell(:wrap => false) do %>
|
10
|
+
<%= mui_block do %>
|
11
|
+
<%= mui_button(:title => 'Create', :url => slice_url(:create), :window => 'open') %>
|
12
|
+
<% end =%>
|
13
|
+
<% end =%>
|
14
|
+
<% end %>
|
15
|
+
<% end =%>
|
16
|
+
<%= mui_divider %>
|
17
|
+
<% if @pages %>
|
18
|
+
<% throw_content :feeds do %>
|
19
|
+
<link href="<%= slice_url :feed %>" rel="alternate" title="RSS" type="application/rss+xml"/>
|
20
|
+
<% end %>
|
21
|
+
<% @pages.each do |page| %>
|
22
|
+
<%= partial(:page, :page => page) %>
|
23
|
+
<%= mui_divider %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<% end =%>
|
27
|
+
<%= mui_cell(:width => '25%') do %>
|
28
|
+
<%= mui_block(:type => 'tray') do %>
|
29
|
+
<%= partial(:search, :searches => @searches) if @pages %>
|
30
|
+
<%= partial(:order, :orders => @orders, :order_property => @order_property) if @orders %>
|
31
|
+
<%= partial(:category, :categories => @categories, :category_id => @category_id) %>
|
32
|
+
<% end =%>
|
33
|
+
<% end =%>
|
34
|
+
<% end =%>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% throw_content :feeds do %>
|
2
|
+
<link href="<%= slice_url :feed %>" rel="alternate" title="RSS" type="application/rss+xml"/>
|
3
|
+
<% end %>
|
4
|
+
<%= merb_words_password_status %>
|
5
|
+
<%= mui_grid(:cell_valign => 'bottom', :columns => 2) do %>
|
6
|
+
<%= mui_cell(:width => '100%') do %>
|
7
|
+
<%= mui_block(:title => @page.title, :title_size => '3em') %>
|
8
|
+
<% end =%>
|
9
|
+
<%= mui_cell(:wrap => false) do %>
|
10
|
+
<%= mui_button(:title => '← Back', :url => slice_url(:index)) %>
|
11
|
+
<% if merb_words_password? %>
|
12
|
+
<%= mui_button(:title => 'Update', :url => slice_url(:update, :page_id => @page.id), :window => 'open') %>
|
13
|
+
<%= mui_button(:title => '×', :tone => 'negative', :url => slice_url(:delete, :page_id => @page.id), :window => 'open') %>
|
14
|
+
<% end %>
|
15
|
+
<% end =%>
|
16
|
+
<% end =%>
|
17
|
+
<%= mui_block do %>
|
18
|
+
<%= merb_words_paragraph(@page.body) %>
|
19
|
+
<% end =%>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= mui_window(:title => 'Update Page') do %>
|
2
|
+
<%= mui_form(:page, :action => slice_url(:update, :page_id => @page.id)) do %>
|
3
|
+
<%= partial(:form) %>
|
4
|
+
<%= mui_block do %>
|
5
|
+
<%= mui_button(:title => 'Update', :submit => true, :tone => 'positive')%>
|
6
|
+
<% end =%>
|
7
|
+
<% end =%>
|
8
|
+
<% end =%>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= mui_grid(:columns => 2) do %>
|
2
|
+
<%= mui_cell do %>
|
3
|
+
<%= mui_block do %>
|
4
|
+
<%= mui_password(:password, :focus => true, :title => 'Password') %>
|
5
|
+
<% end =%>
|
6
|
+
<% end =%>
|
7
|
+
<%= mui_cell do %>
|
8
|
+
<%= mui_block do %>
|
9
|
+
<%= mui_password(:password_confirmation, :title => 'Confirmation') %>
|
10
|
+
<% end =%>
|
11
|
+
<% end =%>
|
12
|
+
<% end =%>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= mui_window(:title => 'Create Password') do %>
|
2
|
+
<%= mui_form(:password, :action => slice_url(:password_create)) do %>
|
3
|
+
<%= partial(:form) %>
|
4
|
+
<%= mui_block do %>
|
5
|
+
<%= mui_button(:title => 'Create', :submit => true, :tone => 'positive')%>
|
6
|
+
<% end =%>
|
7
|
+
<% end =%>
|
8
|
+
<% end =%>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= mui_window(:title => 'Enter Password') do %>
|
2
|
+
<%= mui_form(:password, :action => slice_url(:password_read)) do %>
|
3
|
+
<%= mui_block do %>
|
4
|
+
<%= mui_password(:password, :focus => true, :title => 'Password') %>
|
5
|
+
<% end =%>
|
6
|
+
<%= mui_block do %>
|
7
|
+
<%= mui_button(:title => 'Enter', :submit => true, :tone => 'positive')%>
|
8
|
+
<% end =%>
|
9
|
+
<% end =%>
|
10
|
+
<% end =%>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= mui_window(:title => 'Update/Delete Password') do %>
|
2
|
+
<%= mui_form(:password, :action => slice_url(:password_update)) do %>
|
3
|
+
<%= partial(:form) %>
|
4
|
+
<%= mui_block do %>
|
5
|
+
<%= mui_button(:title => 'Update', :submit => true, :tone => 'positive')%>
|
6
|
+
<%= mui_button(:title => 'Delete', :url => slice_url(:password_delete), :window => 'redirect') %>
|
7
|
+
<% end =%>
|
8
|
+
<% end =%>
|
9
|
+
<% end =%>
|
@@ -0,0 +1,103 @@
|
|
1
|
+
namespace :slices do
|
2
|
+
namespace :merb_words do
|
3
|
+
|
4
|
+
desc "Install MerbWords"
|
5
|
+
task :install => [:preflight, :setup_directories, :copy_assets, :migrate]
|
6
|
+
|
7
|
+
desc "Test for any dependencies"
|
8
|
+
task :preflight do # see slicetasks.rb
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "Setup directories"
|
12
|
+
task :setup_directories do
|
13
|
+
puts "Creating directories for host application"
|
14
|
+
MerbWords.mirrored_components.each do |type|
|
15
|
+
if File.directory?(MerbWords.dir_for(type))
|
16
|
+
if !File.directory?(dst_path = MerbWords.app_dir_for(type))
|
17
|
+
relative_path = dst_path.relative_path_from(Merb.root)
|
18
|
+
puts "- creating directory :#{type} #{File.basename(Merb.root) / relative_path}"
|
19
|
+
mkdir_p(dst_path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Copy stub files to host application"
|
26
|
+
task :stubs do
|
27
|
+
puts "Copying stubs for MerbWords - resolves any collisions"
|
28
|
+
copied, preserved = MerbWords.mirror_stubs!
|
29
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
30
|
+
copied.each { |f| puts "- copied #{f}" }
|
31
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Copy stub files and views to host application"
|
35
|
+
task :patch => [ "stubs", "freeze:views" ]
|
36
|
+
|
37
|
+
desc "Copy public assets to host application"
|
38
|
+
task :copy_assets do
|
39
|
+
puts "Copying assets for MerbWords - resolves any collisions"
|
40
|
+
copied, preserved = MerbWords.mirror_public!
|
41
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
42
|
+
copied.each { |f| puts "- copied #{f}" }
|
43
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "Migrate the database"
|
47
|
+
task :migrate do # see slicetasks.rb
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Freeze MerbWords into your app (only merb-words/app)"
|
51
|
+
task :freeze => [ "freeze:app" ]
|
52
|
+
|
53
|
+
namespace :freeze do
|
54
|
+
|
55
|
+
desc "Freezes MerbWords by installing the gem into application/gems"
|
56
|
+
task :gem do
|
57
|
+
ENV["GEM"] ||= "merb-words"
|
58
|
+
Rake::Task['slices:install_as_gem'].invoke
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "Freezes MerbWords by copying all files from merb-words/app to your application"
|
62
|
+
task :app do
|
63
|
+
puts "Copying all merb-words/app files to your application - resolves any collisions"
|
64
|
+
copied, preserved = MerbWords.mirror_app!
|
65
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
66
|
+
copied.each { |f| puts "- copied #{f}" }
|
67
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Freeze all views into your application for easy modification"
|
71
|
+
task :views do
|
72
|
+
puts "Copying all view templates to your application - resolves any collisions"
|
73
|
+
copied, preserved = MerbWords.mirror_files_for :view
|
74
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
75
|
+
copied.each { |f| puts "- copied #{f}" }
|
76
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "Freeze all models into your application for easy modification"
|
80
|
+
task :models do
|
81
|
+
puts "Copying all models to your application - resolves any collisions"
|
82
|
+
copied, preserved = MerbWords.mirror_files_for :model
|
83
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
84
|
+
copied.each { |f| puts "- copied #{f}" }
|
85
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
86
|
+
end
|
87
|
+
|
88
|
+
desc "Freezes MerbWords as a gem and copies over merb-words/app"
|
89
|
+
task :app_with_gem => [:gem, :app]
|
90
|
+
|
91
|
+
desc "Freezes MerbWords by unpacking all files into your application"
|
92
|
+
task :unpack do
|
93
|
+
puts "Unpacking MerbWords files to your application - resolves any collisions"
|
94
|
+
copied, preserved = MerbWords.unpack_slice!
|
95
|
+
puts "- no files to copy" if copied.empty? && preserved.empty?
|
96
|
+
copied.each { |f| puts "- copied #{f}" }
|
97
|
+
preserved.each { |f| puts "! preserved override as #{f}" }
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
namespace :slices do
|
2
|
+
namespace :merb_words do
|
3
|
+
|
4
|
+
# add your own merb-words tasks here
|
5
|
+
|
6
|
+
# implement this to test for structural/code dependencies
|
7
|
+
# like certain directories or availability of other files
|
8
|
+
desc "Test for any dependencies"
|
9
|
+
task :preflight do
|
10
|
+
end
|
11
|
+
|
12
|
+
# implement this to perform any database related setup steps
|
13
|
+
desc "Migrate the database"
|
14
|
+
task :migrate do
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
namespace :slices do
|
2
|
+
namespace :merb_words do
|
3
|
+
|
4
|
+
desc "Run slice specs within the host application context"
|
5
|
+
task :spec => [ "spec:explain", "spec:default" ]
|
6
|
+
|
7
|
+
namespace :spec do
|
8
|
+
|
9
|
+
slice_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
10
|
+
|
11
|
+
task :explain do
|
12
|
+
puts "\nNote: By running MerbWords specs inside the application context any\n" +
|
13
|
+
"overrides could break existing specs. This isn't always a problem,\n" +
|
14
|
+
"especially in the case of views. Use these spec tasks to check how\n" +
|
15
|
+
"well your application conforms to the original slice implementation."
|
16
|
+
end
|
17
|
+
|
18
|
+
Spec::Rake::SpecTask.new('default') do |t|
|
19
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
20
|
+
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Run all model specs, run a spec for a specific Model with MODEL=MyModel"
|
24
|
+
Spec::Rake::SpecTask.new('model') do |t|
|
25
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
26
|
+
if(ENV['MODEL'])
|
27
|
+
t.spec_files = Dir["#{slice_root}/spec/models/**/#{ENV['MODEL']}_spec.rb"].sort
|
28
|
+
else
|
29
|
+
t.spec_files = Dir["#{slice_root}/spec/models/**/*_spec.rb"].sort
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Run all controller specs, run a spec for a specific Controller with CONTROLLER=MyController"
|
34
|
+
Spec::Rake::SpecTask.new('controller') do |t|
|
35
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
36
|
+
if(ENV['CONTROLLER'])
|
37
|
+
t.spec_files = Dir["#{slice_root}/spec/controllers/**/#{ENV['CONTROLLER']}_spec.rb"].sort
|
38
|
+
else
|
39
|
+
t.spec_files = Dir["#{slice_root}/spec/controllers/**/*_spec.rb"].sort
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Run all view specs, run specs for a specific controller (and view) with CONTROLLER=MyController (VIEW=MyView)"
|
44
|
+
Spec::Rake::SpecTask.new('view') do |t|
|
45
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
46
|
+
if(ENV['CONTROLLER'] and ENV['VIEW'])
|
47
|
+
t.spec_files = Dir["#{slice_root}/spec/views/**/#{ENV['CONTROLLER']}/#{ENV['VIEW']}*_spec.rb"].sort
|
48
|
+
elsif(ENV['CONTROLLER'])
|
49
|
+
t.spec_files = Dir["#{slice_root}/spec/views/**/#{ENV['CONTROLLER']}/*_spec.rb"].sort
|
50
|
+
else
|
51
|
+
t.spec_files = Dir["#{slice_root}/spec/views/**/*_spec.rb"].sort
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Run all specs and output the result in html"
|
56
|
+
Spec::Rake::SpecTask.new('html') do |t|
|
57
|
+
t.spec_opts = ["--format", "html"]
|
58
|
+
t.libs = ['lib', 'server/lib' ]
|
59
|
+
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
data/lib/merb-words.rb
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
if defined?(Merb::Plugins)
|
2
|
+
|
3
|
+
$:.unshift File.dirname(__FILE__)
|
4
|
+
|
5
|
+
load_dependency 'merb-ui'
|
6
|
+
Merb::Plugins.add_rakefiles "merb-words/merbtasks", "merb-words/slicetasks", "merb-words/spectasks"
|
7
|
+
|
8
|
+
# Register the Slice for the current host application
|
9
|
+
Merb::Slices::register(__FILE__)
|
10
|
+
|
11
|
+
# Slice configuration - set this in a before_app_loads callback.
|
12
|
+
# By default a Slice uses its own layout, so you can swicht to
|
13
|
+
# the main application layout or no layout at all if needed.
|
14
|
+
#
|
15
|
+
# Configuration options:
|
16
|
+
# :layout - the layout to use; defaults to :merb-words
|
17
|
+
# :mirror - which path component types to use on copy operations; defaults to all
|
18
|
+
Merb::Slices::config[:merb_words][:layout] ||= :application
|
19
|
+
|
20
|
+
# All Slice code is expected to be namespaced inside a module
|
21
|
+
module MerbWords
|
22
|
+
|
23
|
+
# Slice metadata
|
24
|
+
self.description = "Merb UI Words"
|
25
|
+
self.version = "1.0"
|
26
|
+
self.author = "UI Poet"
|
27
|
+
|
28
|
+
# Stub classes loaded hook - runs before LoadClasses BootLoader
|
29
|
+
# right after a slice's classes have been loaded internally.
|
30
|
+
def self.loaded
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initialization hook - runs before AfterAppLoads BootLoader
|
34
|
+
def self.init
|
35
|
+
end
|
36
|
+
|
37
|
+
# Activation hook - runs after AfterAppLoads BootLoader
|
38
|
+
def self.activate
|
39
|
+
end
|
40
|
+
|
41
|
+
# Deactivation hook - triggered by Merb::Slices.deactivate(MerbWords)
|
42
|
+
def self.deactivate
|
43
|
+
end
|
44
|
+
|
45
|
+
# Setup routes inside the host application
|
46
|
+
#
|
47
|
+
# @param scope<Merb::Router::Behaviour>
|
48
|
+
# Routes will be added within this scope (namespace). In fact, any
|
49
|
+
# router behaviour is a valid namespace, so you can attach
|
50
|
+
# routes at any level of your router setup.
|
51
|
+
#
|
52
|
+
# @note prefix your named routes with :merb_words_
|
53
|
+
# to avoid potential conflicts with global named routes.
|
54
|
+
def self.setup_router(scope)
|
55
|
+
scope.to(:controller => 'pages') do |p|
|
56
|
+
p.match('/').to(:action => 'index').name(:index)
|
57
|
+
p.match('/feed').to(:action => 'feed').name(:feed)
|
58
|
+
p.match('/create', :method => :post).to(:action => 'create_post').name(:create)
|
59
|
+
p.match('/create').to(:action => 'create').name(:create)
|
60
|
+
p.match('/read/:page_id').to(:action => 'read').name(:read)
|
61
|
+
p.match('/update/:page_id', :method => :put).to(:action => 'update_put').name(:update)
|
62
|
+
p.match('/update/:page_id').to(:action => 'update').name(:update)
|
63
|
+
p.match('/delete/:page_id', :method => :delete).to(:action => 'delete_delete').name(:delete)
|
64
|
+
p.match('/delete/:page_id').to(:action => 'delete').name(:delete)
|
65
|
+
p.match('/search/delete/:search').to(:action => 'search_delete').name(:search_delete)
|
66
|
+
end
|
67
|
+
scope.to(:controller => 'categories') do |c|
|
68
|
+
c.match('/category/create', :method => :post).to(:action => 'create_post').name(:category_create)
|
69
|
+
c.match('/category/create').to(:action => 'create').name(:category_create)
|
70
|
+
c.match('/category/update/:category_id', :method => :put).to(:action => 'update_put').name(:category_update)
|
71
|
+
c.match('/category/update/:category_id').to(:action => 'update').name(:category_update)
|
72
|
+
c.match('/category/delete/:category_id', :method => :delete).to(:action => 'delete_delete').name(:category_delete)
|
73
|
+
c.match('/category/delete/:category_id').to(:action => 'delete').name(:category_delete)
|
74
|
+
end
|
75
|
+
scope.to(:controller => 'passwords') do |p|
|
76
|
+
p.match('/password/exit').to(:action => 'exit').name(:password_exit)
|
77
|
+
p.match('/password/create', :method => :post).to(:action => 'create_post').name(:password_create)
|
78
|
+
p.match('/password/create').to(:action => 'create').name(:password_create)
|
79
|
+
p.match('/password/read', :method => :post).to(:action => 'read_post').name(:password_read)
|
80
|
+
p.match('/password/read').to(:action => 'read').name(:password_read)
|
81
|
+
p.match('/password/update', :method => :post).to(:action => 'update_post').name(:password_update)
|
82
|
+
p.match('/password/update').to(:action => 'update').name(:password_update)
|
83
|
+
p.match('/password/delete', :method => :delete).to(:action => 'delete_delete').name(:password_delete)
|
84
|
+
p.match('/password/delete').to(:action => 'delete').name(:password_delete)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
# Setup the slice layout for MerbWords
|
91
|
+
#
|
92
|
+
# Use MerbWords.push_path and MerbWords.push_app_path
|
93
|
+
# to set paths to merb-words-level and app-level paths. Example:
|
94
|
+
#
|
95
|
+
# MerbWords.push_path(:application, MerbWords.root)
|
96
|
+
# MerbWords.push_app_path(:application, Merb.root / 'slices' / 'merb-words')
|
97
|
+
# ...
|
98
|
+
#
|
99
|
+
# Any component path that hasn't been set will default to MerbWords.root
|
100
|
+
#
|
101
|
+
# Or just call setup_default_structure! to setup a basic Merb MVC structure.
|
102
|
+
MerbWords.setup_default_structure!
|
103
|
+
|
104
|
+
# Add dependencies for other MerbWords classes below. Example:
|
105
|
+
# dependency "merb-words/other"
|
106
|
+
|
107
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: merb-words
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.1"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- uipoet
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-11-25 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: merb
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: merb-ui
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0.1"
|
34
|
+
version:
|
35
|
+
description: Word management for Merb.
|
36
|
+
email: dont.tase@me.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README
|
43
|
+
- LICENSE
|
44
|
+
files:
|
45
|
+
- LICENSE
|
46
|
+
- README
|
47
|
+
- Rakefile
|
48
|
+
- lib/merb-words
|
49
|
+
- lib/merb-words/merbtasks.rb
|
50
|
+
- lib/merb-words/slicetasks.rb
|
51
|
+
- lib/merb-words/spectasks.rb
|
52
|
+
- lib/merb-words.rb
|
53
|
+
- app/controllers
|
54
|
+
- app/controllers/application.rb
|
55
|
+
- app/controllers/categories.rb
|
56
|
+
- app/controllers/pages.rb
|
57
|
+
- app/controllers/passwords.rb
|
58
|
+
- app/helpers
|
59
|
+
- app/helpers/application_helper.rb
|
60
|
+
- app/helpers/global_helpers.rb
|
61
|
+
- app/models
|
62
|
+
- app/models/category.rb
|
63
|
+
- app/models/order.rb
|
64
|
+
- app/models/page.rb
|
65
|
+
- app/models/password.rb
|
66
|
+
- app/views
|
67
|
+
- app/views/categories
|
68
|
+
- app/views/categories/_form.html.erb
|
69
|
+
- app/views/categories/create.html.erb
|
70
|
+
- app/views/categories/delete.html.erb
|
71
|
+
- app/views/categories/update.html.erb
|
72
|
+
- app/views/layout
|
73
|
+
- app/views/layout/application.xml.erb
|
74
|
+
- app/views/pages
|
75
|
+
- app/views/pages/_category.html.erb
|
76
|
+
- app/views/pages/_form.html.erb
|
77
|
+
- app/views/pages/_order.html.erb
|
78
|
+
- app/views/pages/_page.html.erb
|
79
|
+
- app/views/pages/_preview.html.erb
|
80
|
+
- app/views/pages/_search.html.erb
|
81
|
+
- app/views/pages/create.html.erb
|
82
|
+
- app/views/pages/delete.html.erb
|
83
|
+
- app/views/pages/feed.xml.erb
|
84
|
+
- app/views/pages/index.html.erb
|
85
|
+
- app/views/pages/read.html.erb
|
86
|
+
- app/views/pages/update.html.erb
|
87
|
+
- app/views/passwords
|
88
|
+
- app/views/passwords/_form.html.erb
|
89
|
+
- app/views/passwords/create.html.erb
|
90
|
+
- app/views/passwords/delete.html.erb
|
91
|
+
- app/views/passwords/read.html.erb
|
92
|
+
- app/views/passwords/update.html.erb
|
93
|
+
has_rdoc: true
|
94
|
+
homepage: http://uipoet.com/
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: "0"
|
105
|
+
version:
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: "0"
|
111
|
+
version:
|
112
|
+
requirements: []
|
113
|
+
|
114
|
+
rubyforge_project: mui
|
115
|
+
rubygems_version: 1.3.1
|
116
|
+
signing_key:
|
117
|
+
specification_version: 2
|
118
|
+
summary: Word management for Merb.
|
119
|
+
test_files: []
|
120
|
+
|