wheels 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -1,2 +1,5 @@
1
1
  class AppConfigsController < InheritedResources::Base
2
+ respond_to :html, :js
3
+ ajax_loading
2
4
  end
5
+
@@ -55,7 +55,7 @@ class SitemapsController < InheritedResources::Base
55
55
  end
56
56
 
57
57
  def destroy
58
- if resource.parent == Sitemap.lost_and_found
58
+ if (resource.parent == Sitemap.lost_and_found) || (resource.resource.is_a? AppConfig)
59
59
  resource.destroy
60
60
  else
61
61
  resource.parent = Sitemap.lost_and_found
@@ -1,6 +1,9 @@
1
1
  class AppConfig < ActiveRecord::Base
2
+ has_many :sitemaps, :as=>:resource
2
3
  after_save :reload
3
- validates :name, :presence=>true
4
+
5
+ before_create :set_name
6
+
4
7
  def self.[](name)
5
8
  val = select{|t| t.name==name}[0].try(:value)
6
9
  if val && (val==val.to_i.to_s)
@@ -8,11 +11,16 @@ class AppConfig < ActiveRecord::Base
8
11
  end
9
12
  val
10
13
  end
14
+
11
15
  def self.current
12
16
  @current ||= AppConfig.all
13
17
  end
14
- def self.reload
15
- @current = nil
18
+ def reload
19
+ AppConfig.instance_variable_set '@current', nil
20
+ end
21
+
22
+ def set_name
23
+ self.name = sitemaps[0].try(:menu_text) unless self.name
16
24
  end
17
25
  end
18
26
 
@@ -86,6 +86,10 @@ class Sitemap < ActiveRecord::Base
86
86
  root.children.select{|t| t.menu_text=='Main Menu'}[0]
87
87
  end
88
88
 
89
+ def self.settings
90
+ root.children.select{|t| t.menu_text=='Settings'}[0]
91
+ end
92
+
89
93
  def self.find_by_path(*path_args)
90
94
  path = path_args.reverse
91
95
  path.delete(nil)
@@ -0,0 +1,11 @@
1
+ = form_for resource, :remote=>true do |f|
2
+ = hidden_field_tag :container, 'content_pane'
3
+ = hidden_field_tag :ajax_function, 'html'
4
+ .field
5
+ .fieldName Name:
6
+ .fieldValue= f.text_field :name
7
+ .field
8
+ .fieldName Value:
9
+ .fieldValue.text_area= f.text_area :value
10
+ .field= f.submit "Save", :disable_with=>"Saving..."
11
+
@@ -0,0 +1,6 @@
1
+ %ul#app_configs
2
+ - collection.each do |app_config|
3
+ %li
4
+ .fieldName= app_config.name
5
+ .fieldValue= app_config.value
6
+
@@ -0,0 +1,4 @@
1
+ %li.app_config
2
+ .fieldName= resource.name
3
+ .fieldValue= resource.value
4
+
@@ -0,0 +1,3 @@
1
+ $('##{container}').#{ajax_function}(#{raw render_js('show')});
2
+ = render :partial => "loadbehind/view"
3
+
@@ -0,0 +1,3 @@
1
+ $('##{container}').remove;
2
+ = render :partial => "loadbehind/destroy"
3
+
@@ -0,0 +1,2 @@
1
+ = render :partial=>'form'
2
+
@@ -0,0 +1,3 @@
1
+ $('##{container}').#{ajax_function}(#{raw render_js('form')});
2
+ = render :partial => "loadbehind/edit"
3
+
@@ -0,0 +1,2 @@
1
+ = render :partial=>'index'
2
+
@@ -0,0 +1,3 @@
1
+ $('##{container}').#{ajax_function}(#{raw render_js('index')});
2
+ = render :partial => "loadbehind/view"
3
+
@@ -0,0 +1,2 @@
1
+ = render :partial=>'form'
2
+
@@ -0,0 +1,3 @@
1
+ $('##{container}').#{ajax_function}(#{raw render_js('form')});
2
+ = render :partial => "loadbehind/edit"
3
+
@@ -0,0 +1,2 @@
1
+ = render :partial=>'show'
2
+
@@ -0,0 +1,3 @@
1
+ $('##{container}').#{ajax_function}(#{raw render_js('show')});
2
+ = render :partial => "loadbehind/view"
3
+
@@ -0,0 +1,3 @@
1
+ $('##{container}').#{ajax_function}(#{raw render_js('show')});
2
+ = render :partial => "loadbehind/view"
3
+
data/lib/wheels/routes.rb CHANGED
@@ -2,10 +2,10 @@ module ActionDispatch::Routing
2
2
  class Mapper
3
3
  def wheels_resources
4
4
  resources :access_control_entries
5
-
5
+ resources :app_configs
6
6
  resources :blogs, :path=>"blog"
7
-
8
7
  resources :external_links
8
+ resources :feedbacks, :path=>"feedback", :only=>[:new, :index, :create]
9
9
 
10
10
  resources :forums do
11
11
  resources :discussions do
@@ -18,16 +18,13 @@ module ActionDispatch::Routing
18
18
  end
19
19
 
20
20
  resources :layouts
21
-
22
21
  resources :menus
23
-
24
22
  resources :pages do
25
23
  resources :attachments
26
24
  resources :children, :controller=>"pages", :as => "children"
27
25
  end
28
26
 
29
27
  resource :profile
30
-
31
28
  resources :sitemaps
32
29
 
33
30
  devise_for :users
data/wheels.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wheels}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyler Gannon"]
@@ -84,6 +84,20 @@ Gem::Specification.new do |s|
84
84
  "app/views/access_control_entries/show.html.haml",
85
85
  "app/views/access_control_entries/show.js.haml",
86
86
  "app/views/access_control_entries/update.js.haml",
87
+ "app/views/app_configs/_form.html.haml",
88
+ "app/views/app_configs/_index.html.haml",
89
+ "app/views/app_configs/_show.html.haml",
90
+ "app/views/app_configs/create.js.haml",
91
+ "app/views/app_configs/destroy.js.haml",
92
+ "app/views/app_configs/edit.html.haml",
93
+ "app/views/app_configs/edit.js.haml",
94
+ "app/views/app_configs/index.html.haml",
95
+ "app/views/app_configs/index.js.haml",
96
+ "app/views/app_configs/new.html.haml",
97
+ "app/views/app_configs/new.js.haml",
98
+ "app/views/app_configs/show.html.haml",
99
+ "app/views/app_configs/show.js.haml",
100
+ "app/views/app_configs/update.js.haml",
87
101
  "app/views/attachments/_form.html.haml",
88
102
  "app/views/attachments/_index.html.haml",
89
103
  "app/views/attachments/_show.html.haml",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tyler Gannon
@@ -107,6 +107,20 @@ files:
107
107
  - app/views/access_control_entries/show.html.haml
108
108
  - app/views/access_control_entries/show.js.haml
109
109
  - app/views/access_control_entries/update.js.haml
110
+ - app/views/app_configs/_form.html.haml
111
+ - app/views/app_configs/_index.html.haml
112
+ - app/views/app_configs/_show.html.haml
113
+ - app/views/app_configs/create.js.haml
114
+ - app/views/app_configs/destroy.js.haml
115
+ - app/views/app_configs/edit.html.haml
116
+ - app/views/app_configs/edit.js.haml
117
+ - app/views/app_configs/index.html.haml
118
+ - app/views/app_configs/index.js.haml
119
+ - app/views/app_configs/new.html.haml
120
+ - app/views/app_configs/new.js.haml
121
+ - app/views/app_configs/show.html.haml
122
+ - app/views/app_configs/show.js.haml
123
+ - app/views/app_configs/update.js.haml
110
124
  - app/views/attachments/_form.html.haml
111
125
  - app/views/attachments/_index.html.haml
112
126
  - app/views/attachments/_show.html.haml