active_application 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/.gitignore +22 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +10 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CONTRIBUTING.md +43 -0
  6. data/Gemfile +7 -0
  7. data/Guardfile +29 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +37 -0
  10. data/Rakefile +7 -0
  11. data/active_application.gemspec +42 -0
  12. data/app/assets/javascripts/active_application/base.js +4 -0
  13. data/app/assets/stylesheets/active_application/base.css +5 -0
  14. data/app/assets/stylesheets/active_application/layout.css +17 -0
  15. data/app/assets/stylesheets/bootstrap_and_overrides.css.less +28 -0
  16. data/app/controllers/active_application/public_controller.rb +5 -0
  17. data/app/controllers/active_application/resource_controller.rb +23 -0
  18. data/app/controllers/active_application/user_resource_controller.rb +14 -0
  19. data/app/helpers/active_application/base_helper.rb +7 -0
  20. data/app/helpers/active_application/bootstrap_helper.rb +8 -0
  21. data/app/helpers/active_application/layout_helper.rb +23 -0
  22. data/app/helpers/simple_resource/custom_helper.rb +41 -0
  23. data/app/models/active_application/user.rb +12 -0
  24. data/app/views/active_application/public/404.html.erb +7 -0
  25. data/app/views/active_application/public/index.html.erb +0 -0
  26. data/app/views/devise/passwords/edit.html.erb +11 -0
  27. data/app/views/devise/passwords/new.html.erb +9 -0
  28. data/app/views/devise/registrations/edit.html.erb +39 -0
  29. data/app/views/devise/registrations/new.html.erb +11 -0
  30. data/app/views/devise/sessions/new.html.erb +10 -0
  31. data/app/views/kaminari/_first_page.html.erb +7 -0
  32. data/app/views/kaminari/_gap.html.erb +1 -0
  33. data/app/views/kaminari/_last_page.html.erb +7 -0
  34. data/app/views/kaminari/_next_page.html.erb +7 -0
  35. data/app/views/kaminari/_page.html.erb +7 -0
  36. data/app/views/kaminari/_paginator.html.erb +17 -0
  37. data/app/views/kaminari/_prev_page.html.erb +7 -0
  38. data/app/views/layouts/application.html.erb +47 -0
  39. data/app/views/simple_resource/base/_collection.html.erb +26 -0
  40. data/config/routes.rb +0 -0
  41. data/lib/active_application/engine.rb +31 -0
  42. data/lib/active_application/routes.rb +32 -0
  43. data/lib/active_application/version.rb +3 -0
  44. data/lib/active_application.rb +16 -0
  45. data/lib/generators/active_application/cancan/cancan_generator.rb +15 -0
  46. data/lib/generators/active_application/cancan/templates/ability.rb +10 -0
  47. data/lib/generators/active_application/devise/devise_generator.rb +46 -0
  48. data/lib/generators/active_application/install/install_generator.rb +21 -0
  49. data/spec/dummy/README.rdoc +261 -0
  50. data/spec/dummy/Rakefile +7 -0
  51. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  52. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  53. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  54. data/spec/dummy/app/controllers/milestones_controller.rb +3 -0
  55. data/spec/dummy/app/controllers/projects_controller.rb +2 -0
  56. data/spec/dummy/app/controllers/tasks_controller.rb +3 -0
  57. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  58. data/spec/dummy/app/mailers/.gitkeep +0 -0
  59. data/spec/dummy/app/models/.gitkeep +0 -0
  60. data/spec/dummy/app/models/ability.rb +11 -0
  61. data/spec/dummy/app/models/milestone.rb +6 -0
  62. data/spec/dummy/app/models/project.rb +8 -0
  63. data/spec/dummy/app/models/task.rb +4 -0
  64. data/spec/dummy/app/models/user.rb +3 -0
  65. data/spec/dummy/app/views/layouts/_menu.html.erb +3 -0
  66. data/spec/dummy/app/views/projects/_actions.html.erb +3 -0
  67. data/spec/dummy/config/application.rb +65 -0
  68. data/spec/dummy/config/boot.rb +10 -0
  69. data/spec/dummy/config/database.yml +25 -0
  70. data/spec/dummy/config/environment.rb +5 -0
  71. data/spec/dummy/config/environments/development.rb +37 -0
  72. data/spec/dummy/config/environments/production.rb +67 -0
  73. data/spec/dummy/config/environments/test.rb +37 -0
  74. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  75. data/spec/dummy/config/initializers/devise.rb +232 -0
  76. data/spec/dummy/config/initializers/inflections.rb +15 -0
  77. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  78. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  79. data/spec/dummy/config/initializers/session_store.rb +8 -0
  80. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  81. data/spec/dummy/config/locales/devise.en.yml +58 -0
  82. data/spec/dummy/config/locales/en.yml +5 -0
  83. data/spec/dummy/config/routes.rb +12 -0
  84. data/spec/dummy/config.ru +4 -0
  85. data/spec/dummy/db/migrate/20121018181406_devise_create_users.rb +46 -0
  86. data/spec/dummy/db/migrate/20121018214335_create_projects.rb +12 -0
  87. data/spec/dummy/db/migrate/20121019000703_create_milestones.rb +12 -0
  88. data/spec/dummy/db/migrate/20121019001551_create_tasks.rb +13 -0
  89. data/spec/dummy/db/schema.rb +70 -0
  90. data/spec/dummy/db/seeds.rb +0 -0
  91. data/spec/dummy/lib/assets/.gitkeep +0 -0
  92. data/spec/dummy/log/.gitkeep +0 -0
  93. data/spec/dummy/public/404.html +26 -0
  94. data/spec/dummy/public/422.html +26 -0
  95. data/spec/dummy/public/500.html +25 -0
  96. data/spec/dummy/public/favicon.ico +0 -0
  97. data/spec/dummy/script/rails +6 -0
  98. data/spec/factories/users.rb +6 -0
  99. data/spec/features/users/forgot_password_spec.rb +138 -0
  100. data/spec/features/users/sign_up_confirmation_spec.rb +51 -0
  101. data/spec/features/visitors/sign_up_spec.rb +114 -0
  102. data/spec/helpers/base_helper_spec.rb +9 -0
  103. data/spec/spec_helper.rb +40 -0
  104. data/spec/support/helpers.rb +9 -0
  105. 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
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
5
+ before_script:
6
+ - "cd spec/dummy; rake db:migrate; cd ../.."
7
+ - "cd spec/dummy; rake db:test:prepare; cd ../.."
8
+ notifications:
9
+ recipients:
10
+ - info@jarijokinen.com
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ 0.0.1 (December 1, 2012)
4
+
5
+ * Initial release; alpha stage
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
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "cancan"
6
+ gem "devise"
7
+ gem "jquery-rails"
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
+ [![Build Status](https://secure.travis-ci.org/jarijokinen/active_applicatio.png)](http://travis-ci.org/jarijokinen/active_application) [![Code Climate](https://codeclimate.com/badge.png)](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,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ desc "Run RSpec"
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: :spec
@@ -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,4 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require modernizr
4
+ //= require twitter/bootstrap
@@ -0,0 +1,5 @@
1
+ /*
2
+ *= require bootstrap_and_overrides
3
+ *= require formtastic-bootstrap
4
+ *= require active_application/layout
5
+ */
@@ -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,5 @@
1
+ class ActiveApplication::PublicController < ::ApplicationController
2
+ def not_found
3
+ return render "active_application/public/404", status: :not_found, layout: false
4
+ end
5
+ end
@@ -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,7 @@
1
+ module ActiveApplication
2
+ module BaseHelper
3
+ def application_name
4
+ I18n.t("active_application.application_name", default: "Active Application")
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ module ActiveApplication
2
+ module BootstrapHelper
3
+ def tab(name, id, active = false)
4
+ classes = active ? ["tab", "active"] : ["tab"]
5
+ content_tag(:li, link_to(name, "##{id}", "data-toggle" => "tab"), class: classes)
6
+ end
7
+ end
8
+ 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">&times;</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
@@ -0,0 +1,7 @@
1
+ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2
+ <html><head>
3
+ <title>404 Not Found</title>
4
+ </head><body>
5
+ <h1>Not Found</h1>
6
+ <p>The requested URL was not found on this server.</p>
7
+ </body></html>
@@ -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,7 @@
1
+ <%=
2
+ content_tag(:li,
3
+ link_to_unless(current_page.first?, raw(t "views.pagination.first"), url) do
4
+ content_tag(:span, raw(t "views.pagination.first"), class: "active")
5
+ end
6
+ )
7
+ %>
@@ -0,0 +1 @@
1
+ <%= content_tag(:li, raw(t 'views.pagination.truncate')) %>
@@ -0,0 +1,7 @@
1
+ <%=
2
+ content_tag(:li,
3
+ link_to_unless(current_page.last?, raw(t "views.pagination.last"), url) do
4
+ content_tag(:span, raw(t "views.pagination.last"), class: "active")
5
+ end
6
+ )
7
+ %>
@@ -0,0 +1,7 @@
1
+ <%=
2
+ content_tag(:li,
3
+ link_to_unless(current_page.last?, raw(t "views.pagination.next"), url) do
4
+ content_tag(:span, raw(t "views.pagination.next"), class: "active")
5
+ end
6
+ )
7
+ %>
@@ -0,0 +1,7 @@
1
+ <%=
2
+ content_tag(:li,
3
+ link_to_unless(page.current?, page, url) do
4
+ content_tag(:span, page, class: "active")
5
+ end
6
+ )
7
+ %>
@@ -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 -%>
@@ -0,0 +1,7 @@
1
+ <%=
2
+ content_tag(:li,
3
+ link_to_unless(current_page.first?, raw(t "views.pagination.previous"), url) do
4
+ content_tag(:span, raw(t "views.pagination.previous"), class: "active")
5
+ end
6
+ )
7
+ %>