home_page 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/app/assets/javascripts/home_page/application.js +3 -0
  3. data/app/assets/javascripts/home_page/loader.js +16 -0
  4. data/app/assets/stylesheets/home_page/application.css +5 -0
  5. data/app/assets/stylesheets/home_page/base.less +10 -0
  6. data/app/assets/stylesheets/home_page/bootswatch.css.less +5 -0
  7. data/app/assets/stylesheets/home_page/loader.css.less +51 -0
  8. data/app/assets/stylesheets/home_page/mixins.less +42 -0
  9. data/app/assets/stylesheets/home_page/variables.less +860 -0
  10. data/app/controllers/devise_extensions/registrations_controller.rb +32 -0
  11. data/app/controllers/home_controller.rb +4 -0
  12. data/app/controllers/home_page/application_controller.rb +19 -0
  13. data/app/controllers/users_controller.rb +39 -0
  14. data/app/helpers/home_page/application_helper.rb +26 -0
  15. data/app/helpers/home_page/layout_helper.rb +29 -0
  16. data/app/models/user.rb +20 -0
  17. data/app/views/devise/registrations/new.html.erb +3 -0
  18. data/app/views/home/index.html.erb +0 -0
  19. data/app/views/layouts/application.html.erb +56 -0
  20. data/app/views/users/_form.html.erb +25 -0
  21. data/app/views/users/edit.html.erb +3 -0
  22. data/app/views/users/index.html.erb +34 -0
  23. data/app/views/users/new.html.erb +3 -0
  24. data/config/initializers/devise.rb +259 -0
  25. data/config/initializers/simple_form.rb +166 -0
  26. data/config/initializers/simple_form_bootstrap.rb +136 -0
  27. data/config/initializers/simple_navigation.rb +2 -0
  28. data/config/locales/devise.en.yml +61 -0
  29. data/config/locales/general/en.yml +40 -0
  30. data/config/locales/resources/user/en.yml +17 -0
  31. data/config/locales/simple_form.en.yml +31 -0
  32. data/config/routes.rb +6 -1
  33. data/db/migrate/20150307152542_create_initial_schema.rb +53 -0
  34. data/lib/home_page.rb +17 -1
  35. data/lib/home_page/engine.rb +5 -0
  36. data/lib/home_page/navigation.rb +66 -0
  37. data/lib/home_page/simple_navigation_renderer/breadcrumbs_without_method_links.rb +28 -0
  38. data/lib/home_page/simple_navigation_renderer/twitter_sidenav.rb +30 -0
  39. data/lib/home_page/version.rb +1 -1
  40. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  41. metadata +218 -27
data/config/routes.rb CHANGED
@@ -1,2 +1,7 @@
1
1
  Rails.application.routes.draw do
2
- end
2
+ devise_for :users, controllers: { registrations: 'devise_extensions/registrations' }
3
+
4
+ resources :users, only: [:index, :edit, :update, :destroy]
5
+
6
+ root to: 'home#index'
7
+ end
@@ -0,0 +1,53 @@
1
+ class CreateInitialSchema < ActiveRecord::Migration
2
+ def self.up
3
+ create_table(:users) do |t|
4
+ t.string :name
5
+ t.string :slug
6
+ t.string :password
7
+ t.string :first_name
8
+ t.string :last_name
9
+
10
+ ## Database authenticatable
11
+ t.string :email, null: false, default: ""
12
+ t.string :encrypted_password, null: false, default: ""
13
+
14
+ ## Recoverable
15
+ t.string :reset_password_token
16
+ t.datetime :reset_password_sent_at
17
+
18
+ ## Rememberable
19
+ t.datetime :remember_created_at
20
+
21
+ ## Trackable
22
+ t.integer :sign_in_count, default: 0, null: false
23
+ t.datetime :current_sign_in_at
24
+ t.datetime :last_sign_in_at
25
+ t.string :current_sign_in_ip
26
+ t.string :last_sign_in_ip
27
+
28
+ ## Confirmable
29
+ t.string :confirmation_token
30
+ t.datetime :confirmed_at
31
+ t.datetime :confirmation_sent_at
32
+ t.string :unconfirmed_email # Only if using reconfirmable
33
+
34
+ ## Lockable
35
+ t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
36
+ t.string :unlock_token # Only if unlock strategy is :email or :both
37
+ t.datetime :locked_at
38
+
39
+ t.timestamps
40
+ end
41
+
42
+ add_index :users, :name, unique: true
43
+ add_index :users, :email, unique: true
44
+ add_index :users, :reset_password_token, unique: true
45
+ add_index :users, :unlock_token, unique: true
46
+ end
47
+
48
+ def self.down
49
+ # By default, we don't want to make any assumption about how to roll back a migration when your
50
+ # model already existed. Please edit below which fields you would like to remove in this migration.
51
+ raise ActiveRecord::IrreversibleMigration
52
+ end
53
+ end
data/lib/home_page.rb CHANGED
@@ -1,4 +1,20 @@
1
- require "home_page/engine"
1
+ require 'v8'
2
+ require 'twitter-bootswatch-rails'
3
+ require 'jquery-rails'
4
+ require 'devise'
5
+ require 'friendly_id'
6
+ require 'recaptcha/rails'
7
+ require 'protected_attributes'
8
+ require 'active_record/deprecated_finders'
9
+ require 'simple_form'
10
+ require 'simple-navigation'
11
+ require 'simple-navigation-bootstrap'
12
+
13
+ require 'home_page/navigation'
14
+ require 'home_page/simple_navigation_renderer/breadcrumbs_without_method_links'
15
+ require 'home_page/simple_navigation_renderer/twitter_sidenav'
16
+
17
+ require 'home_page/engine'
2
18
 
3
19
  module HomePage
4
20
  end
@@ -1,4 +1,9 @@
1
1
  module HomePage
2
2
  class Engine < ::Rails::Engine
3
+ config.autoload_paths << File.expand_path("../../../app/models/concerns", __FILE__)
4
+ config.autoload_paths << File.expand_path("../../../app/controllers/concerns", __FILE__)
5
+ config.i18n.load_path += Dir[File.expand_path("../../../config/locales/**/*.{rb,yml}", __FILE__)]
6
+
7
+ config.generators{|g| g.orm :active_record }
3
8
  end
4
9
  end
@@ -0,0 +1,66 @@
1
+ module HomePage
2
+ module Navigation
3
+ class Base
4
+ @@products = {}
5
+ @@menu_options = {}
6
+
7
+ def self.add_product(slug, text)
8
+ @@products[slug] = text
9
+ end
10
+
11
+ def self.products
12
+ @@products
13
+ end
14
+
15
+ def self.add_menu_option(resource, option, value)
16
+ @@menu_options[resource] ||= {}
17
+ @@menu_options[resource][option] = value
18
+ end
19
+
20
+ def self.menu_options(resource)
21
+ @@menu_options[resource] ||= {}
22
+ @@menu_options[resource]
23
+ end
24
+ end
25
+
26
+ def self.code
27
+ Proc.new do |navigation|
28
+ navigation.items do |primary, options|
29
+ primary.dom_class = 'nav navbar-nav'
30
+
31
+ [:users, :authentication].each do |resource|
32
+ instance_exec primary, ::HomePage::Navigation::Base.menu_options(resource), &::HomePage::Navigation.menu_code(resource)
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ def self.menu_code(resource)
39
+ case resource
40
+ when :users
41
+ Proc.new do |primary, options|
42
+ if user_signed_in?
43
+ primary.item :users, I18n.t('users.index.title'), users_path do |users|
44
+ unless (@user.new_record? rescue true) || current_user.try(:id) == @user.id
45
+ if options[:after_resource_has_many]
46
+ instance_exec users, {}, &options[:after_resource_has_many]
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ when :authentication
53
+ Proc.new do |primary, options|
54
+ if user_signed_in?
55
+ primary.item :sign_out, I18n.t('authentication.sign_out'), destroy_user_session_path, method: :delete
56
+ else
57
+ primary.item :authentication, I18n.t('authentication.title'), new_user_session_path do |authentication|
58
+ authentication.item :sign_in, I18n.t('authentication.sign_in'), new_user_session_path
59
+ authentication.item :sign_up, I18n.t('authentication.sign_up'), new_user_registration_path
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,28 @@
1
+ # Renders an ItemContainer as a <div> element and its containing items as <a> elements.
2
+ # It only renders 'selected' elements.
3
+ #
4
+ # By default, the renderer sets the item's key as dom_id for the rendered <a> element unless the config option <tt>autogenerate_item_ids</tt> is set to false.
5
+ # The id can also be explicitely specified by setting the id in the html-options of the 'item' method in the config/navigation.rb file.
6
+ # The ItemContainer's dom_class and dom_id are applied to the surrounding <div> element.
7
+ #
8
+ module HomePage
9
+ module SimpleNavigationRenderer
10
+ class BreadcrumbsWithoutMethodLinks < ::SimpleNavigation::Renderer::Breadcrumbs
11
+ protected
12
+
13
+ def a_tags(item_container, parent_list = [])
14
+ item_container.items.inject([]) do |list, item|
15
+ if item.method.blank? && item.selected?
16
+ list << tag_for(item) unless parent_list.join('').match(item.url.split('#').first)
17
+
18
+ if include_sub_navigation?(item)
19
+ list.concat a_tags(item.sub_navigation, list.clone)
20
+ end
21
+ end
22
+
23
+ list
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ module HomePage
2
+ module SimpleNavigationRenderer
3
+ class TwitterSidenav < ::SimpleNavigation::Renderer::Base
4
+ def render(item_container)
5
+ content, first_item_selected = '', false
6
+
7
+ item_container.items.each do |item|
8
+ next if [I18n.t('general.edit'), I18n.t('general.destroy')].include?(item.name)
9
+
10
+ selected = item.selected? && item.method.blank?
11
+ klass = selected && !first_item_selected ? 'active' : ''
12
+ options = {}
13
+
14
+ # only highlight on item
15
+ first_item_selected = true if selected
16
+
17
+ if item.method.present?
18
+ options.merge!(method: item.method, confirm: I18n.t('general.questions.are_you_sure'))
19
+ end
20
+
21
+ content += content_tag :li, link_to(item.name, item.url, options), class: klass
22
+ end
23
+
24
+ ul = content_tag :ul, content, class: 'nav nav-list'
25
+
26
+ content_tag :div, ul, class: 'well sidebar-nav'
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module HomePage
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,13 @@
1
+ <%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
2
+ <%%= f.error_notification %>
3
+
4
+ <div class="form-inputs">
5
+ <%- attributes.each do |attribute| -%>
6
+ <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
7
+ <%- end -%>
8
+ </div>
9
+
10
+ <div class="form-actions">
11
+ <%%= f.button :submit %>
12
+ </div>
13
+ <%% end %>
metadata CHANGED
@@ -1,46 +1,209 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: home_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mathias Gawlista
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-03-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: 4.2.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: 4.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: protected_attributes
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: activerecord-deprecated_finders
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.3
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: therubyracer
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: twitter-bootswatch-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.3.2.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.3.2.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: twitter-bootswatch-rails-fontawesome
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 4.3.0.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 4.3.0.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: jquery-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 4.0.3
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 4.0.3
111
+ - !ruby/object:Gem::Dependency
112
+ name: devise
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 3.4.1
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 3.4.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: friendly_id
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 5.1.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 5.1.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: recaptcha
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.3.6
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.3.6
153
+ - !ruby/object:Gem::Dependency
154
+ name: simple_form
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 3.1.0
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 3.1.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: simple-navigation
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 3.14.0
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 3.14.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: simple-navigation-bootstrap
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 1.0.0
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 1.0.0
30
195
  - !ruby/object:Gem::Dependency
31
196
  name: mysql2
32
197
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
198
  requirements:
35
- - - ! '>='
199
+ - - ">="
36
200
  - !ruby/object:Gem::Version
37
201
  version: '0'
38
202
  type: :development
39
203
  prerelease: false
40
204
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
205
  requirements:
43
- - - ! '>='
206
+ - - ">="
44
207
  - !ruby/object:Gem::Version
45
208
  version: '0'
46
209
  description: Simple content management system with optional modules for maintaining
@@ -52,44 +215,72 @@ executables: []
52
215
  extensions: []
53
216
  extra_rdoc_files: []
54
217
  files:
218
+ - MIT-LICENSE
219
+ - README.rdoc
220
+ - Rakefile
221
+ - app/assets/javascripts/home_page/application.js
222
+ - app/assets/javascripts/home_page/loader.js
223
+ - app/assets/stylesheets/home_page/application.css
224
+ - app/assets/stylesheets/home_page/base.less
225
+ - app/assets/stylesheets/home_page/bootswatch.css.less
226
+ - app/assets/stylesheets/home_page/loader.css.less
227
+ - app/assets/stylesheets/home_page/mixins.less
228
+ - app/assets/stylesheets/home_page/variables.less
229
+ - app/controllers/devise_extensions/registrations_controller.rb
230
+ - app/controllers/home_controller.rb
231
+ - app/controllers/home_page/application_controller.rb
232
+ - app/controllers/users_controller.rb
233
+ - app/helpers/home_page/application_helper.rb
234
+ - app/helpers/home_page/layout_helper.rb
235
+ - app/models/user.rb
236
+ - app/views/devise/registrations/new.html.erb
237
+ - app/views/home/index.html.erb
238
+ - app/views/layouts/application.html.erb
239
+ - app/views/users/_form.html.erb
240
+ - app/views/users/edit.html.erb
241
+ - app/views/users/index.html.erb
242
+ - app/views/users/new.html.erb
243
+ - config/initializers/devise.rb
244
+ - config/initializers/simple_form.rb
245
+ - config/initializers/simple_form_bootstrap.rb
246
+ - config/initializers/simple_navigation.rb
247
+ - config/locales/devise.en.yml
248
+ - config/locales/general/en.yml
249
+ - config/locales/resources/user/en.yml
250
+ - config/locales/simple_form.en.yml
55
251
  - config/routes.rb
252
+ - db/migrate/20150307152542_create_initial_schema.rb
253
+ - lib/home_page.rb
56
254
  - lib/home_page/engine.rb
255
+ - lib/home_page/navigation.rb
256
+ - lib/home_page/simple_navigation_renderer/breadcrumbs_without_method_links.rb
257
+ - lib/home_page/simple_navigation_renderer/twitter_sidenav.rb
57
258
  - lib/home_page/version.rb
58
- - lib/home_page.rb
59
259
  - lib/tasks/home_page_tasks.rake
60
- - MIT-LICENSE
61
- - Rakefile
62
- - README.rdoc
260
+ - lib/templates/erb/scaffold/_form.html.erb
63
261
  homepage: http://Home-Page.Software
64
262
  licenses:
65
263
  - MIT
264
+ metadata: {}
66
265
  post_install_message:
67
266
  rdoc_options: []
68
267
  require_paths:
69
268
  - lib
70
269
  required_ruby_version: !ruby/object:Gem::Requirement
71
- none: false
72
270
  requirements:
73
- - - ! '>='
271
+ - - ">="
74
272
  - !ruby/object:Gem::Version
75
273
  version: '0'
76
- segments:
77
- - 0
78
- hash: 2644027218805524704
79
274
  required_rubygems_version: !ruby/object:Gem::Requirement
80
- none: false
81
275
  requirements:
82
- - - ! '>='
276
+ - - ">="
83
277
  - !ruby/object:Gem::Version
84
278
  version: '0'
85
- segments:
86
- - 0
87
- hash: 2644027218805524704
88
279
  requirements: []
89
280
  rubyforge_project:
90
- rubygems_version: 1.8.23
281
+ rubygems_version: 2.4.5
91
282
  signing_key:
92
- specification_version: 3
283
+ specification_version: 4
93
284
  summary: Simple content management system for maintaining personal web pages but not
94
285
  usable yet.
95
286
  test_files: []