active_application 0.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/.gitignore +22 -0
- data/.rspec +1 -0
- data/.travis.yml +10 -0
- data/CHANGELOG.md +5 -0
- data/CONTRIBUTING.md +43 -0
- data/Gemfile +7 -0
- data/Guardfile +29 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +7 -0
- data/active_application.gemspec +42 -0
- data/app/assets/javascripts/active_application/base.js +4 -0
- data/app/assets/stylesheets/active_application/base.css +5 -0
- data/app/assets/stylesheets/active_application/layout.css +17 -0
- data/app/assets/stylesheets/bootstrap_and_overrides.css.less +28 -0
- data/app/controllers/active_application/public_controller.rb +5 -0
- data/app/controllers/active_application/resource_controller.rb +23 -0
- data/app/controllers/active_application/user_resource_controller.rb +14 -0
- data/app/helpers/active_application/base_helper.rb +7 -0
- data/app/helpers/active_application/bootstrap_helper.rb +8 -0
- data/app/helpers/active_application/layout_helper.rb +23 -0
- data/app/helpers/simple_resource/custom_helper.rb +41 -0
- data/app/models/active_application/user.rb +12 -0
- data/app/views/active_application/public/404.html.erb +7 -0
- data/app/views/active_application/public/index.html.erb +0 -0
- data/app/views/devise/passwords/edit.html.erb +11 -0
- data/app/views/devise/passwords/new.html.erb +9 -0
- data/app/views/devise/registrations/edit.html.erb +39 -0
- data/app/views/devise/registrations/new.html.erb +11 -0
- data/app/views/devise/sessions/new.html.erb +10 -0
- data/app/views/kaminari/_first_page.html.erb +7 -0
- data/app/views/kaminari/_gap.html.erb +1 -0
- data/app/views/kaminari/_last_page.html.erb +7 -0
- data/app/views/kaminari/_next_page.html.erb +7 -0
- data/app/views/kaminari/_page.html.erb +7 -0
- data/app/views/kaminari/_paginator.html.erb +17 -0
- data/app/views/kaminari/_prev_page.html.erb +7 -0
- data/app/views/layouts/application.html.erb +47 -0
- data/app/views/simple_resource/base/_collection.html.erb +26 -0
- data/config/routes.rb +0 -0
- data/lib/active_application/engine.rb +31 -0
- data/lib/active_application/routes.rb +32 -0
- data/lib/active_application/version.rb +3 -0
- data/lib/active_application.rb +16 -0
- data/lib/generators/active_application/cancan/cancan_generator.rb +15 -0
- data/lib/generators/active_application/cancan/templates/ability.rb +10 -0
- data/lib/generators/active_application/devise/devise_generator.rb +46 -0
- data/lib/generators/active_application/install/install_generator.rb +21 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/milestones_controller.rb +3 -0
- data/spec/dummy/app/controllers/projects_controller.rb +2 -0
- data/spec/dummy/app/controllers/tasks_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/ability.rb +11 -0
- data/spec/dummy/app/models/milestone.rb +6 -0
- data/spec/dummy/app/models/project.rb +8 -0
- data/spec/dummy/app/models/task.rb +4 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/views/layouts/_menu.html.erb +3 -0
- data/spec/dummy/app/views/projects/_actions.html.erb +3 -0
- data/spec/dummy/config/application.rb +65 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +232 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/devise.en.yml +58 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +12 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20121018181406_devise_create_users.rb +46 -0
- data/spec/dummy/db/migrate/20121018214335_create_projects.rb +12 -0
- data/spec/dummy/db/migrate/20121019000703_create_milestones.rb +12 -0
- data/spec/dummy/db/migrate/20121019001551_create_tasks.rb +13 -0
- data/spec/dummy/db/schema.rb +70 -0
- data/spec/dummy/db/seeds.rb +0 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/users.rb +6 -0
- data/spec/features/users/forgot_password_spec.rb +138 -0
- data/spec/features/users/sign_up_confirmation_spec.rb +51 -0
- data/spec/features/visitors/sign_up_spec.rb +114 -0
- data/spec/helpers/base_helper_spec.rb +9 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/support/helpers.rb +9 -0
- metadata +563 -0
data/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
log/*.log
|
|
19
|
+
spec/dummy/db/*.sqlite3
|
|
20
|
+
spec/dummy/log/*.log
|
|
21
|
+
spec/dummy/tmp/
|
|
22
|
+
spec/dummy/.sass-cache
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--color
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Contributing to ActiveApplication
|
|
2
|
+
|
|
3
|
+
## Forking the project
|
|
4
|
+
|
|
5
|
+
1. Click the "Fork" button in https://github.com/jarijokinen/active_application
|
|
6
|
+
2. Clone your fork (`git clone https://github.com/[username]/active_application.git`)
|
|
7
|
+
3. Track the original repository (`git remote add upstream https://github.com/jarijokinen/active_application.git`)
|
|
8
|
+
4. Fetch new changes from the original repository (`git fetch upstream`)
|
|
9
|
+
5. Merge any changes fetched from the original repository (`git merge upstream/master`)
|
|
10
|
+
|
|
11
|
+
## Using your own fork in your applications
|
|
12
|
+
|
|
13
|
+
Add this line to your application's Gemfile:
|
|
14
|
+
|
|
15
|
+
gem "active_application", git: "https://github.com/[username]/active_application.git"
|
|
16
|
+
|
|
17
|
+
Replace the [username] with your GitHub username.
|
|
18
|
+
|
|
19
|
+
And then execute:
|
|
20
|
+
|
|
21
|
+
$ bundle
|
|
22
|
+
|
|
23
|
+
## Running tests
|
|
24
|
+
|
|
25
|
+
Start Guard:
|
|
26
|
+
|
|
27
|
+
$ bundle exec guard start
|
|
28
|
+
|
|
29
|
+
Run all specs by pressing the enter.
|
|
30
|
+
|
|
31
|
+
## Adding a new feature
|
|
32
|
+
|
|
33
|
+
1. Fork the project
|
|
34
|
+
2. Run tests and make sure they pass
|
|
35
|
+
3. Create a new branch (`git checkout -b my-new-feature`)
|
|
36
|
+
4. Write tests for your new feature and make sure they fail
|
|
37
|
+
5. Write a code for your new feature and make sure all tests pass
|
|
38
|
+
6. Commit your changes (`git commit -am 'Add some feature'`)
|
|
39
|
+
7. Push your branch into the repository (`git push origin my-new-feature`)
|
|
40
|
+
|
|
41
|
+
## Adding your changes to the original repository
|
|
42
|
+
|
|
43
|
+
1. Create a new Pull Request in GitHub
|
data/Gemfile
ADDED
data/Guardfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
guard "spork", rspec_env: { "RAILS_ENV" => "test" } do
|
|
2
|
+
watch("config/application.rb")
|
|
3
|
+
watch("config/environment.rb")
|
|
4
|
+
watch("config/environments/test.rb")
|
|
5
|
+
watch(%r{^config/initializers/.+\.rb$})
|
|
6
|
+
watch("Gemfile")
|
|
7
|
+
watch("Gemfile.lock")
|
|
8
|
+
watch("spec/spec_helper.rb") { :rspec }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
guard "rspec", cli: "--drb --color", all_on_start: false, all_after_pass: false do
|
|
12
|
+
watch(%r{^spec/.+_spec\.rb$})
|
|
13
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
|
14
|
+
watch("spec/spec_helper.rb") { "spec" }
|
|
15
|
+
|
|
16
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
|
17
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
|
18
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
|
19
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
|
20
|
+
watch("config/routes.rb") { "spec/routing" }
|
|
21
|
+
watch("app/controllers/application_controller.rb") { "spec/controllers" }
|
|
22
|
+
|
|
23
|
+
# Capybara request specs
|
|
24
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
|
25
|
+
|
|
26
|
+
# Turnip features and steps
|
|
27
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
|
28
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance" }
|
|
29
|
+
end
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2012 Jari Jokinen
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# ActiveApplication
|
|
2
|
+
|
|
3
|
+
NOTICE: EXPERIMENTAL ALPHA VERSION, DO NOT USE IN PRODUCTION
|
|
4
|
+
|
|
5
|
+
[](http://travis-ci.org/jarijokinen/active_application) [](https://codeclimate.com/github/jarijokinen/active_application)
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
* Authentication by Devise
|
|
10
|
+
* Authorization by CanCan
|
|
11
|
+
* Formtastic as a form builder
|
|
12
|
+
* Twitter Bootstrap as a CSS framework
|
|
13
|
+
* Resource handling by SimpleResource
|
|
14
|
+
* Pagination by Kaminari
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
* Ruby 1.9 or greater
|
|
19
|
+
* Rails 3.2 or greater
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Add this line to your application's Gemfile:
|
|
24
|
+
|
|
25
|
+
gem "active_application"
|
|
26
|
+
|
|
27
|
+
And then execute:
|
|
28
|
+
|
|
29
|
+
$ bundle
|
|
30
|
+
|
|
31
|
+
## Support
|
|
32
|
+
|
|
33
|
+
If you have any questions or issues with ActiveApplication, or if you like to report a bug, please create an [issue on GitHub](https://github.com/jarijokinen/active_application/issues).
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
MIT License. Copyright (c) 2012 [Jari Jokinen](http://jarijokinen.com). See [LICENSE](https://github.com/jarijokinen/active_application/blob/master/LICENSE.txt) for further details.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'active_application/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |gem|
|
|
7
|
+
gem.name = "active_application"
|
|
8
|
+
gem.version = ActiveApplication::VERSION
|
|
9
|
+
gem.authors = ["Jari Jokinen"]
|
|
10
|
+
gem.email = ["info@jarijokinen.com"]
|
|
11
|
+
gem.description = "Application framework for Rails"
|
|
12
|
+
gem.summary = "Application framework for Rails"
|
|
13
|
+
gem.homepage = "https://github.com/jarijokinen/active_application"
|
|
14
|
+
|
|
15
|
+
gem.files = `git ls-files`.split($/)
|
|
16
|
+
gem.test_files = gem.files.grep(%r{^spec/})
|
|
17
|
+
gem.require_paths = ["lib"]
|
|
18
|
+
|
|
19
|
+
gem.add_dependency "rails", "~> 3.2.9"
|
|
20
|
+
gem.add_dependency "cancan", "~> 1.6.8"
|
|
21
|
+
gem.add_dependency "devise", "~> 2.1.2"
|
|
22
|
+
gem.add_dependency "formtastic-bootstrap", "~> 2.0.0"
|
|
23
|
+
gem.add_dependency "has_scope", "~> 0.5.1"
|
|
24
|
+
gem.add_dependency "kaminari", "~> 0.14.1"
|
|
25
|
+
gem.add_dependency "less-rails", "~> 2.2.6"
|
|
26
|
+
gem.add_dependency "modernizr-rails", "~> 2.6.1"
|
|
27
|
+
gem.add_dependency "simple_resource", "~> 0.1.0"
|
|
28
|
+
gem.add_dependency "therubyracer", "~> 0.10.2"
|
|
29
|
+
gem.add_dependency "twitter-bootstrap-rails", "~> 2.1.6"
|
|
30
|
+
|
|
31
|
+
gem.add_development_dependency "capybara", "~> 2.0.1"
|
|
32
|
+
gem.add_development_dependency "database_cleaner", "~> 0.9.1"
|
|
33
|
+
gem.add_development_dependency "factory_girl_rails", "~> 4.1.0"
|
|
34
|
+
gem.add_development_dependency "forgery", "~> 0.5.0"
|
|
35
|
+
gem.add_development_dependency "guard-rspec", "~> 2.3.0"
|
|
36
|
+
gem.add_development_dependency "guard-spork", "~> 1.4.0"
|
|
37
|
+
gem.add_development_dependency "launchy", "~> 2.1.2"
|
|
38
|
+
gem.add_development_dependency "rb-inotify", "~> 0.8.8"
|
|
39
|
+
gem.add_development_dependency "rspec-rails", "~> 2.12.0"
|
|
40
|
+
gem.add_development_dependency "spork-rails", "~> 3.2.0"
|
|
41
|
+
gem.add_development_dependency "sqlite3", "~> 1.3.6"
|
|
42
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
body {
|
|
2
|
+
padding-top: 60px;
|
|
3
|
+
}
|
|
4
|
+
@media (max-width: 979px) {
|
|
5
|
+
body {
|
|
6
|
+
padding-top: 0;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
.footer {
|
|
10
|
+
font-size: 10px;
|
|
11
|
+
padding: 5px 0 30px 0;
|
|
12
|
+
border-top: 1px solid #eee;
|
|
13
|
+
margin-top: 30px;
|
|
14
|
+
}
|
|
15
|
+
table .actions {
|
|
16
|
+
text-align: right;
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@import "twitter/bootstrap/bootstrap";
|
|
2
|
+
@import "twitter/bootstrap/responsive";
|
|
3
|
+
|
|
4
|
+
// Set the correct sprite paths
|
|
5
|
+
@iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings.png");
|
|
6
|
+
@iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white.png");
|
|
7
|
+
|
|
8
|
+
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
|
|
9
|
+
// Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not
|
|
10
|
+
// have the proper paths. So for now we use the absolute path.
|
|
11
|
+
@fontAwesomeEotPath: asset-path("fontawesome-webfont.eot");
|
|
12
|
+
@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff");
|
|
13
|
+
@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf");
|
|
14
|
+
@fontAwesomeSvgPath: asset-path("fontawesome-webfont.svg");
|
|
15
|
+
|
|
16
|
+
// Font Awesome
|
|
17
|
+
//@import "fontawesome";
|
|
18
|
+
|
|
19
|
+
// Your custom LESS stylesheets goes here
|
|
20
|
+
//
|
|
21
|
+
// Since bootstrap was imported above you have access to its mixins which
|
|
22
|
+
// you may use and inherit here
|
|
23
|
+
//
|
|
24
|
+
// If you'd like to override bootstrap's own variables, you can do so here as well
|
|
25
|
+
// See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation
|
|
26
|
+
//
|
|
27
|
+
// Example:
|
|
28
|
+
// @linkColor: #ff0000;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class ActiveApplication::ResourceController < SimpleResource::BaseController
|
|
2
|
+
defaults route_prefix: ""
|
|
3
|
+
before_filter :authenticate_user!
|
|
4
|
+
load_and_authorize_resource
|
|
5
|
+
|
|
6
|
+
has_scope :page, default: 1
|
|
7
|
+
|
|
8
|
+
def render_not_found
|
|
9
|
+
render "active_application/public/404", status: :not_found, layout: false
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
rescue_from CanCan::AccessDenied do |exception|
|
|
13
|
+
return render_not_found
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create
|
|
17
|
+
create! { collection_url }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def update
|
|
21
|
+
update! { collection_url }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class ActiveApplication::UserResourceController < ActiveApplication::ResourceController
|
|
2
|
+
defaults route_prefix: ""
|
|
3
|
+
before_filter :exclude_fields
|
|
4
|
+
|
|
5
|
+
def exclude_fields
|
|
6
|
+
@exclude_fields = %w(user_id)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
protected
|
|
10
|
+
|
|
11
|
+
def begin_of_association_chain
|
|
12
|
+
current_user
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module ActiveApplication
|
|
2
|
+
module LayoutHelper
|
|
3
|
+
def layout_flash
|
|
4
|
+
html = Array.new
|
|
5
|
+
flash.each do |key, msg|
|
|
6
|
+
case key.to_s
|
|
7
|
+
when "alert"
|
|
8
|
+
flash_class = "alert-error"
|
|
9
|
+
when "notice"
|
|
10
|
+
flash_class = "alert-info"
|
|
11
|
+
else
|
|
12
|
+
flash_class = key.to_s
|
|
13
|
+
end
|
|
14
|
+
html << content_tag(:div,
|
|
15
|
+
msg.html_safe + ' <a class="close" href="#" data-dismiss="alert">×</a>'.html_safe,
|
|
16
|
+
class: ["fade", "in", "alert", flash_class],
|
|
17
|
+
"data-alert" => "alert"
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
html.join.html_safe
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module SimpleResource
|
|
2
|
+
module CustomHelper
|
|
3
|
+
def resource_human_attributes
|
|
4
|
+
human_attributes = resource_attributes - non_human_attributes
|
|
5
|
+
|
|
6
|
+
if @exclude_fields
|
|
7
|
+
human_attributes = human_attributes - @exclude_fields
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
if respond_to?("parent?")
|
|
11
|
+
human_attributes = human_attributes - ["#{parent.class.name.underscore}_id"]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
human_attributes
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def new_resource_link
|
|
18
|
+
link_to("<i class='icon-plus-sign'></i> #{new_resource_title}".html_safe, new_resource_path, class: "btn")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def link_to_action(action_name, title, path)
|
|
22
|
+
action_name = action_name.to_sym
|
|
23
|
+
if action_name == :delete
|
|
24
|
+
link_to(t("simple_resource.#{action_name.to_s}", default: title), path,
|
|
25
|
+
method: :delete, confirm: t("simple_resource.delete_confirmation", default: "Are you sure?"), class: "btn btn-mini btn-danger")
|
|
26
|
+
else
|
|
27
|
+
link_to(t("simple_resource.#{action_name.to_s}", default: title), path, class: "btn btn-mini")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def default_actions_for(resource)
|
|
32
|
+
html = Array.new
|
|
33
|
+
html << link_to_action(:show, "<i class='icon-zoom-in'></i> Show".html_safe, resource_path(resource))
|
|
34
|
+
html << link_to_action(:edit, "<i class='icon-edit'></i> Edit".html_safe, edit_resource_path(resource))
|
|
35
|
+
html << link_to_action(:delete, "<i class='icon-trash icon-white'></i> Delete".html_safe, resource_path(resource))
|
|
36
|
+
html.join("\n").html_safe
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
SimpleResource::BaseHelper.extend SimpleResource::CustomHelper
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module ActiveApplication
|
|
2
|
+
class User < ActiveRecord::Base
|
|
3
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me
|
|
4
|
+
|
|
5
|
+
devise :database_authenticatable, :registerable, :confirmable,
|
|
6
|
+
:recoverable, :rememberable, :trackable, :validatable
|
|
7
|
+
|
|
8
|
+
def to_s
|
|
9
|
+
email
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<% @title = t("devise.change_password", :default => "Change Your Password") %>
|
|
2
|
+
|
|
3
|
+
<%= semantic_form_for(resource, :as => resource_name,
|
|
4
|
+
:url => password_path(resource_name), :html => { :method => :put }) do |f| %>
|
|
5
|
+
<%= f.input :password %>
|
|
6
|
+
<%= f.input :password_confirmation, required: true %>
|
|
7
|
+
<%= f.input :reset_password_token, :as => :hidden %>
|
|
8
|
+
<%= f.actions do %>
|
|
9
|
+
<%= f.action :submit, label: t("devise.change_my_password", :default => "Change My Password") %>
|
|
10
|
+
<% end %>
|
|
11
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% @title = t("devise.forgot_password", :default => "Forgot Your Password?") %>
|
|
2
|
+
|
|
3
|
+
<%= semantic_form_for(resource, :as => resource_name,
|
|
4
|
+
:url => password_path(resource_name), :html => { :method => :post }) do |f| %>
|
|
5
|
+
<%= f.inputs :email %>
|
|
6
|
+
<%= f.actions do %>
|
|
7
|
+
<%= f.action :submit, label: t("devise.send_reset_password_instructions", :default => "Send me reset password instructions") %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<% @title = t("devise.my_account", default: "My Account") %>
|
|
2
|
+
<%
|
|
3
|
+
if params[:user] && params[:user][:password]
|
|
4
|
+
email_class = ""
|
|
5
|
+
password_class = "active"
|
|
6
|
+
else
|
|
7
|
+
email_class = "active"
|
|
8
|
+
password_class = ""
|
|
9
|
+
end
|
|
10
|
+
%>
|
|
11
|
+
|
|
12
|
+
<div class="tabbable">
|
|
13
|
+
|
|
14
|
+
<ul class="nav nav-tabs">
|
|
15
|
+
<%= tab(t("devise.change_email", default: "Change Email"), "change_email", (email_class == "active")) %>
|
|
16
|
+
<%= tab(t("devise.change_password", default: "Change Password"), "change_password", (password_class == "active")) %>
|
|
17
|
+
</ul>
|
|
18
|
+
|
|
19
|
+
<%= semantic_form_for(resource, as: resource_name,
|
|
20
|
+
url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
|
21
|
+
|
|
22
|
+
<div class="tab-content">
|
|
23
|
+
<%= f.inputs id: "change_email", class: ["tab-pane", email_class] do %>
|
|
24
|
+
<%= f.input :email, required: true %>
|
|
25
|
+
<% end %>
|
|
26
|
+
<%= f.inputs id: "change_password", class: ["tab-pane", password_class] do %>
|
|
27
|
+
<%= f.input :password, required: true %>
|
|
28
|
+
<%= f.input :password_confirmation, required: true %>
|
|
29
|
+
<% end %>
|
|
30
|
+
<%= f.inputs do %>
|
|
31
|
+
<%= f.input :current_password, required: true, hint: t("devise.current_password_hint", default: "We need your current password to confirm your changes.") %>
|
|
32
|
+
<% end %>
|
|
33
|
+
</div>
|
|
34
|
+
<%= f.actions do %>
|
|
35
|
+
<%= f.action :submit, label: t(:update, default: "Update") %>
|
|
36
|
+
<% end %>
|
|
37
|
+
<% end %>
|
|
38
|
+
|
|
39
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<% @title = t("devise.sign_up", default: "Sign up") %>
|
|
2
|
+
|
|
3
|
+
<%= semantic_form_for(resource, as: resource_name,
|
|
4
|
+
url: registration_path(resource_name)) do |f| %>
|
|
5
|
+
<%= f.input :email %>
|
|
6
|
+
<%= f.input :password %>
|
|
7
|
+
<%= f.input :password_confirmation, required: true %>
|
|
8
|
+
<%= f.actions do %>
|
|
9
|
+
<%= f.action :submit, label: t("devise.sign_up", default: "Sign up") %>
|
|
10
|
+
<% end %>
|
|
11
|
+
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<% @title = t("devise.sign_in", default: "Sign in") %>
|
|
2
|
+
|
|
3
|
+
<%= semantic_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
|
4
|
+
<%= f.inputs :email, :password %>
|
|
5
|
+
<%= f.actions do %>
|
|
6
|
+
<%= f.action :submit, label: t("devise.sign_in", default: "Sign in") %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% end %>
|
|
9
|
+
|
|
10
|
+
<%= link_to(t("devise.forgot_password", default: "Forgot Your Password?"), new_user_password_path) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= content_tag(:li, raw(t 'views.pagination.truncate')) %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= paginator.render do -%>
|
|
2
|
+
<nav class="pagination">
|
|
3
|
+
<ul>
|
|
4
|
+
<%= first_page_tag %>
|
|
5
|
+
<%= prev_page_tag %>
|
|
6
|
+
<% each_page do |page| -%>
|
|
7
|
+
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
|
8
|
+
<%= page_tag page %>
|
|
9
|
+
<% elsif !page.was_truncated? -%>
|
|
10
|
+
<%= gap_tag %>
|
|
11
|
+
<% end -%>
|
|
12
|
+
<% end -%>
|
|
13
|
+
<%= next_page_tag %>
|
|
14
|
+
<%= last_page_tag %>
|
|
15
|
+
</ul>
|
|
16
|
+
</nav>
|
|
17
|
+
<% end -%>
|