soapbox 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.10
1
+ 0.2.11
@@ -61,7 +61,7 @@ class Admin::AdminController < ApplicationController
61
61
  unless params[:success].nil?
62
62
  render :js => params[:success]
63
63
  else
64
- render :js => "flash_error('Updated Successfully')"
64
+ render :js => "flash_notice('Updated Successfully')"
65
65
  end
66
66
  }
67
67
  failure.html { render "form" }
@@ -1,10 +1,12 @@
1
1
  module MenuHelper
2
+
2
3
  def menu_nav(name)
3
4
  items = Menu.find_by_name(name).menu_items
4
5
  html = ""
5
6
  html << "<ul id='#{ name }_nav'>"
6
7
  items.each do |item|
7
- html << "<li>"
8
+ next if (!item.menuable.published? && !user_logged_in? rescue false) # add published method to any menuable object
9
+ html << "<li class='#{item.label_text.gsub(" ","_").downcase}'>"
8
10
  if item.menuable_id.nil?
9
11
  html << link_to(item.label_text, eval("#{item.menuable_type.tableize}_path()"))
10
12
  else
@@ -23,4 +25,5 @@ module MenuHelper
23
25
  html << "</ul>"
24
26
  html.html_safe
25
27
  end
28
+
26
29
  end
@@ -1,4 +1,5 @@
1
1
  module PageHelper
2
+
2
3
  def breadcrumb(page)
3
4
  html = ""
4
5
  while page = page.parent
@@ -6,11 +7,13 @@ module PageHelper
6
7
  end
7
8
  html.html_safe
8
9
  end
9
- def page_nav(pages = Page.where("parent_id is ?", nil), id = nil)
10
+
11
+ def page_nav(pages = Page.published.where("parent_id is ?", nil), id = nil)
10
12
  html = ""
11
13
  html << "<ul id='#{ id || "" }'>"
12
14
  pages.each do |page|
13
- html << "<li>"
15
+ next if (!page.published? && !user_logged_in? rescue false) # add published method to any menuable object
16
+ html << "<li class='#{page.nav_label.gsub(" ","_").downcase}'>"
14
17
  html << link_to(page.nav_label != "" ? page.nav_label : page.title, page.homepage? ? "/" : page_path(page))
15
18
  html << page_nav(page.children) if !page.children.empty?
16
19
  html << "</li>"
@@ -18,4 +21,5 @@ module PageHelper
18
21
  html << "</ul>"
19
22
  html.html_safe
20
23
  end
24
+
21
25
  end
@@ -115,4 +115,8 @@ module SoapboxHelper
115
115
  html.html_safe
116
116
  end
117
117
 
118
+ def words(html, limit)
119
+ html.gsub(/<\/?[^>]*>/, "").split(" ")[1..limit].join(" ")
120
+ end
121
+
118
122
  end
@@ -13,7 +13,7 @@
13
13
  data: {
14
14
  'page[template]': $('#page_template').val(),
15
15
  'page[id]': #{@page.id},
16
- authenticity_token: encodeURIComponent('#{form_authenticity_token.inspect}')
16
+ authenticity_token: #{form_authenticity_token.inspect}
17
17
  },
18
18
  type: 'PUT',
19
19
  success: function(){
@@ -9,32 +9,35 @@ class SoapboxScaffoldGenerator < Rails::Generators::NamedBase
9
9
  def manifest
10
10
  # Copy controller, model and migration
11
11
  directories = [
12
- "app",
13
- "app/controllers",
14
- "app/controllers/admin",
15
- "app/views",
16
- "app/views/admin",
17
- "app/models",
18
- "app/helpers",
19
- "config",
12
+ "vendor/plugins/#{plural_name}/app",
13
+ "vendor/plugins/#{plural_name}/app/controllers",
14
+ "vendor/plugins/#{plural_name}/app/controllers/admin",
15
+ "vendor/plugins/#{plural_name}/app/views",
16
+ "vendor/plugins/#{plural_name}/app/views/admin",
17
+ "vendor/plugins/#{plural_name}/app/models",
18
+ "vendor/plugins/#{plural_name}/config",
20
19
  "db",
21
- "db/migrate"
20
+ "db/migrate",
21
+ "vendor/plugins/#{plural_name}/lib",
22
+ "vendor/plugins/#{plural_name}/db",
23
+ "vendor/plugins/#{plural_name}/db/migrate"
22
24
  ]
23
25
 
24
26
  directories.each do |dir|
25
27
  empty_directory dir
26
28
  end
27
29
 
28
- template "admin_controller.rb", "app/controllers/admin/#{plural_name}_controller.rb"
29
- template "controller.rb", "app/controllers/#{plural_name}_controller.rb"
30
- template "model.rb", "app/models/#{singular_name}.rb"
30
+ template "admin_controller.rb", "vendor/plugins/#{plural_name}/app/controllers/admin/#{plural_name}_controller.rb"
31
+ template "controller.rb", "vendor/plugins/#{plural_name}/app/controllers/#{plural_name}_controller.rb"
32
+ template "model.rb", "vendor/plugins/#{plural_name}/app/models/#{singular_name}.rb"
31
33
 
32
34
  # Create migration
33
35
  migration_name = "#{Time.new.utc.strftime("%Y%m%d%H%M%S")}_create_#{singular_name.pluralize}.rb"
34
36
  template 'migration.rb', "db/migrate/#{migration_name}"
37
+ template 'migration.rb', "vendor/plugins/#{plural_name}/db/migrate/#{migration_name}"
35
38
 
36
39
  # Create view directory
37
- admin_view_dir = File.join("app/views/admin", plural_name)
40
+ admin_view_dir = File.join("vendor/plugins/#{plural_name}/app/views/admin", plural_name)
38
41
  empty_directory admin_view_dir
39
42
 
40
43
  # Copy in all views
@@ -44,7 +47,7 @@ class SoapboxScaffoldGenerator < Rails::Generators::NamedBase
44
47
  end
45
48
 
46
49
  # Create view directory
47
- view_dir = File.join("app/views", plural_name)
50
+ view_dir = File.join("vendor/plugins/#{plural_name}/app/views", plural_name)
48
51
  empty_directory view_dir
49
52
 
50
53
  # Copy in all views
@@ -53,11 +56,14 @@ class SoapboxScaffoldGenerator < Rails::Generators::NamedBase
53
56
  template "views/#{view_file}", "#{view_dir}/#{view_file}"
54
57
  end
55
58
 
59
+ template "routes.rb", "vendor/plugins/#{plural_name}/config/routes.rb"
60
+ template "engine.rb", "vendor/plugins/#{plural_name}/lib/engine.rb"
61
+
56
62
  # Add resources to routes.rb
57
- look_for = "# Resources"
58
- gsub_file('config/routes.rb', /(#{Regexp.escape(look_for)})/mi){|match| "#{match}\n resources :#{plural_name}, :only => [:index, :show]"}
59
- look_for = "# Admin Resources"
60
- gsub_file('config/routes.rb', /(#{Regexp.escape(look_for)})/mi){|match| "#{match}\n resources :#{plural_name}"}
63
+ # look_for = "# Resources"
64
+ # gsub_file('config/routes.rb', /(#{Regexp.escape(look_for)})/mi){|match| "#{match}\n resources :#{plural_name}, :only => [:index, :show]"}
65
+ # look_for = "# Admin Resources"
66
+ # gsub_file('config/routes.rb', /(#{Regexp.escape(look_for)})/mi){|match| "#{match}\n resources :#{plural_name}"}
61
67
 
62
68
  puts "IMPORTANT"
63
69
  puts "---------------------------------------"
@@ -0,0 +1,7 @@
1
+ module <%= class_name %>
2
+ class Engine < Rails::Engine
3
+ initializer "static assets" do |app|
4
+ app.middleware.use ::ActionDispatch::Static, "#{root}/public"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ Rails.application.routes.draw do |map|
2
+
3
+ resources :<%= plural_name %>, :only => [:index, :show]
4
+
5
+ namespace :admin do
6
+ resources :<%= plural_name %>
7
+ end
8
+
9
+ end
data/soapbox.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{soapbox}
8
- s.version = "0.2.10"
8
+ s.version = "0.2.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Gabe Coyne}, %q{Killit Creative}]
12
- s.date = %q{2011-11-14}
12
+ s.date = %q{2011-11-15}
13
13
  s.description = %q{manage pages, users, permissions, settings, analytics, files, users, and extend}
14
14
  s.email = %q{gabe@killitcreative.com}
15
15
  s.extra_rdoc_files = [
@@ -147,8 +147,10 @@ Gem::Specification.new do |s|
147
147
  "lib/generators/soapbox_scaffold/soapbox_scaffold_generator.rb",
148
148
  "lib/generators/soapbox_scaffold/templates/admin_controller.rb",
149
149
  "lib/generators/soapbox_scaffold/templates/controller.rb",
150
+ "lib/generators/soapbox_scaffold/templates/engine.rb",
150
151
  "lib/generators/soapbox_scaffold/templates/migration.rb",
151
152
  "lib/generators/soapbox_scaffold/templates/model.rb",
153
+ "lib/generators/soapbox_scaffold/templates/routes.rb",
152
154
  "lib/generators/soapbox_scaffold/templates/views/admin/form.html.erb",
153
155
  "lib/generators/soapbox_scaffold/templates/views/admin/index.html.erb",
154
156
  "lib/generators/soapbox_scaffold/templates/views/index.html.erb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soapbox
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 10
10
- version: 0.2.10
9
+ - 11
10
+ version: 0.2.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gabe Coyne
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-11-14 00:00:00 Z
19
+ date: 2011-11-15 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -457,8 +457,10 @@ files:
457
457
  - lib/generators/soapbox_scaffold/soapbox_scaffold_generator.rb
458
458
  - lib/generators/soapbox_scaffold/templates/admin_controller.rb
459
459
  - lib/generators/soapbox_scaffold/templates/controller.rb
460
+ - lib/generators/soapbox_scaffold/templates/engine.rb
460
461
  - lib/generators/soapbox_scaffold/templates/migration.rb
461
462
  - lib/generators/soapbox_scaffold/templates/model.rb
463
+ - lib/generators/soapbox_scaffold/templates/routes.rb
462
464
  - lib/generators/soapbox_scaffold/templates/views/admin/form.html.erb
463
465
  - lib/generators/soapbox_scaffold/templates/views/admin/index.html.erb
464
466
  - lib/generators/soapbox_scaffold/templates/views/index.html.erb