jquery-modal-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.gitignore +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +22 -0
  5. data/README.md +81 -0
  6. data/Rakefile +2 -0
  7. data/demoapp/Gemfile +41 -0
  8. data/demoapp/README.rdoc +261 -0
  9. data/demoapp/Rakefile +7 -0
  10. data/demoapp/app/assets/images/rails.png +0 -0
  11. data/demoapp/app/assets/javascripts/application.js +17 -0
  12. data/demoapp/app/assets/javascripts/users.js.coffee +3 -0
  13. data/demoapp/app/assets/stylesheets/application.css +15 -0
  14. data/demoapp/app/assets/stylesheets/scaffolds.css.scss +56 -0
  15. data/demoapp/app/assets/stylesheets/users.css.scss +3 -0
  16. data/demoapp/app/controllers/application_controller.rb +3 -0
  17. data/demoapp/app/controllers/users_controller.rb +89 -0
  18. data/demoapp/app/helpers/application_helper.rb +2 -0
  19. data/demoapp/app/helpers/users_helper.rb +2 -0
  20. data/demoapp/app/models/user.rb +7 -0
  21. data/demoapp/app/views/layouts/application.html.erb +14 -0
  22. data/demoapp/app/views/users/_form.html.erb +25 -0
  23. data/demoapp/app/views/users/edit.html.erb +6 -0
  24. data/demoapp/app/views/users/index.html.erb +31 -0
  25. data/demoapp/app/views/users/new.html.erb +5 -0
  26. data/demoapp/app/views/users/show.html.erb +15 -0
  27. data/demoapp/config.ru +4 -0
  28. data/demoapp/config/application.rb +62 -0
  29. data/demoapp/config/boot.rb +6 -0
  30. data/demoapp/config/database.yml +25 -0
  31. data/demoapp/config/environment.rb +5 -0
  32. data/demoapp/config/environments/development.rb +37 -0
  33. data/demoapp/config/environments/production.rb +67 -0
  34. data/demoapp/config/environments/test.rb +37 -0
  35. data/demoapp/config/initializers/backtrace_silencers.rb +7 -0
  36. data/demoapp/config/initializers/inflections.rb +15 -0
  37. data/demoapp/config/initializers/mime_types.rb +5 -0
  38. data/demoapp/config/initializers/secret_token.rb +7 -0
  39. data/demoapp/config/initializers/session_store.rb +8 -0
  40. data/demoapp/config/initializers/wrap_parameters.rb +14 -0
  41. data/demoapp/config/locales/en.yml +5 -0
  42. data/demoapp/config/routes.rb +4 -0
  43. data/demoapp/db/development.sqlite3 +0 -0
  44. data/demoapp/db/migrate/20120621084323_create_users.rb +10 -0
  45. data/demoapp/db/schema.rb +23 -0
  46. data/demoapp/db/seeds.rb +7 -0
  47. data/demoapp/doc/README_FOR_APP +2 -0
  48. data/demoapp/public/404.html +26 -0
  49. data/demoapp/public/422.html +26 -0
  50. data/demoapp/public/500.html +25 -0
  51. data/demoapp/public/favicon.ico +0 -0
  52. data/demoapp/public/robots.txt +5 -0
  53. data/demoapp/script/rails +6 -0
  54. data/demoapp/test/fixtures/users.yml +9 -0
  55. data/demoapp/test/functional/users_controller_test.rb +49 -0
  56. data/demoapp/test/performance/browsing_test.rb +12 -0
  57. data/demoapp/test/test_helper.rb +13 -0
  58. data/demoapp/test/unit/helpers/users_helper_test.rb +4 -0
  59. data/demoapp/test/unit/user_test.rb +7 -0
  60. data/jquery-modal-rails.gemspec +24 -0
  61. data/lib/jquery-modal-rails.rb +3 -0
  62. data/lib/jquery/modal/filters.rb +9 -0
  63. data/lib/jquery/modal/filters/ajax_request_filters.rb +18 -0
  64. data/lib/jquery/modal/helpers.rb +9 -0
  65. data/lib/jquery/modal/helpers/link_helpers.rb +33 -0
  66. data/lib/jquery/modal/rails.rb +7 -0
  67. data/lib/jquery/modal/rails/engine.rb +8 -0
  68. data/lib/jquery/modal/rails/version.rb +8 -0
  69. data/vendor/assets/images/close.png +0 -0
  70. data/vendor/assets/images/spinner.gif +0 -0
  71. data/vendor/assets/javascripts/jquery.modal.js +265 -0
  72. data/vendor/assets/stylesheets/jquery.modal.css +45 -0
  73. metadata +189 -0
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require jquery.ui.all
13
+ *= require jquery.modal
14
+ *= require_tree .
15
+ */
@@ -0,0 +1,56 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px; }
7
+
8
+ p, ol, ul, td {
9
+ font-family: verdana, arial, helvetica, sans-serif;
10
+ font-size: 13px;
11
+ line-height: 18px; }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px; }
17
+
18
+ a {
19
+ color: #000;
20
+ &:visited {
21
+ color: #666; }
22
+ &:hover {
23
+ color: #fff;
24
+ background-color: #000; } }
25
+
26
+ div {
27
+ &.field, &.actions {
28
+ margin-bottom: 10px; } }
29
+
30
+ #notice {
31
+ color: green; }
32
+
33
+ .field_with_errors {
34
+ padding: 2px;
35
+ background-color: red;
36
+ display: table; }
37
+
38
+ #error_explanation {
39
+ width: 450px;
40
+ border: 2px solid red;
41
+ padding: 7px;
42
+ padding-bottom: 0;
43
+ margin-bottom: 20px;
44
+ background-color: #f0f0f0;
45
+ h2 {
46
+ text-align: left;
47
+ font-weight: bold;
48
+ padding: 5px 5px 5px 15px;
49
+ font-size: 12px;
50
+ margin: -7px;
51
+ margin-bottom: 0px;
52
+ background-color: #c00;
53
+ color: #fff; }
54
+ ul li {
55
+ font-size: 12px;
56
+ list-style: square; } }
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the users controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,89 @@
1
+ class UsersController < ApplicationController
2
+ # GET /users
3
+ # GET /users.json
4
+ def index
5
+ @users = User.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @users }
10
+ end
11
+ end
12
+
13
+ # GET /users/1
14
+ # GET /users/1.json
15
+ def show
16
+ @user = User.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @user }
21
+ end
22
+ end
23
+
24
+ # GET /users/new
25
+ # GET /users/new.json
26
+ def new
27
+ @user = User.new
28
+
29
+ # just sleep 5 seconds
30
+ sleep 2
31
+
32
+ respond_to do |format|
33
+ format.html # new.html.erb
34
+ format.json { render json: @user }
35
+ end
36
+ end
37
+
38
+ # GET /users/1/edit
39
+ def edit
40
+ @user = User.find(params[:id])
41
+ end
42
+
43
+ # POST /users
44
+ # POST /users.json
45
+ def create
46
+ @user = User.new(params[:user])
47
+
48
+ # just sleep 5 seconds
49
+ sleep 2
50
+
51
+ respond_to do |format|
52
+ if @user.save
53
+ format.html { redirect_to @user, notice: 'User was successfully created.' }
54
+ format.json { render json: @user, status: :created, location: @user }
55
+ else
56
+ format.html { render action: "new" }
57
+ format.json { render json: @user.errors, status: :unprocessable_entity }
58
+ end
59
+ end
60
+ end
61
+
62
+ # PUT /users/1
63
+ # PUT /users/1.json
64
+ def update
65
+ @user = User.find(params[:id])
66
+
67
+ respond_to do |format|
68
+ if @user.update_attributes(params[:user])
69
+ format.html { redirect_to @user, notice: 'User was successfully updated.' }
70
+ format.json { head :no_content }
71
+ else
72
+ format.html { render action: "edit" }
73
+ format.json { render json: @user.errors, status: :unprocessable_entity }
74
+ end
75
+ end
76
+ end
77
+
78
+ # DELETE /users/1
79
+ # DELETE /users/1.json
80
+ def destroy
81
+ @user = User.find(params[:id])
82
+ @user.destroy
83
+
84
+ respond_to do |format|
85
+ format.html { redirect_to users_url }
86
+ format.json { head :no_content }
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
@@ -0,0 +1,7 @@
1
+ class User < ActiveRecord::Base
2
+ attr_accessible :email, :name
3
+
4
+ validates :name, :presence => true
5
+
6
+ end
7
+
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Demoapp</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,25 @@
1
+ <%= form_for(@user) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :name %><br />
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :email %><br />
20
+ <%= f.text_field :email %>
21
+ </div>
22
+ <div class="actions">
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @user %> |
6
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,31 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Email</th>
7
+ <th></th>
8
+ <th></th>
9
+ <th></th>
10
+ </tr>
11
+
12
+ <% @users.each do |user| %>
13
+ <tr>
14
+ <td><%= user.name %></td>
15
+ <td><%= user.email %></td>
16
+ <td><%= link_to 'Show', user %></td>
17
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
18
+ <td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
22
+
23
+ <br />
24
+ <div id="diag" style="display:none;">Hudel Welcom Coll</div>
25
+
26
+ <%= link_to 'New User Normal', new_user_path %><BR/>
27
+ <%= link_to_modal 'New User Modal', new_user_path %><BR/>
28
+
29
+ <%= link_to_modal 'New User Modal Sized', new_user_path, :width=> "600", :height =>"400", :remote => true %><BR/>
30
+
31
+ <%= link_to_modal 'DIV in the page', "#diag" %><BR/>
@@ -0,0 +1,5 @@
1
+ <h1>New user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', users_path, :rel => "modal:close" %>
@@ -0,0 +1,15 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Name:</b>
5
+ <%= @user.name %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Email:</b>
10
+ <%= @user.email %>
11
+ </p>
12
+
13
+
14
+ <%= link_to 'Edit', edit_user_path(@user) %> |
15
+ <%= link_to 'Back', users_path %>
data/demoapp/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Demoapp::Application
@@ -0,0 +1,62 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
+
12
+ module Demoapp
13
+ class Application < Rails::Application
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # Configure the default encoding used in templates for Ruby 1.9.
37
+ config.encoding = "utf-8"
38
+
39
+ # Configure sensitive parameters which will be filtered from the log file.
40
+ config.filter_parameters += [:password]
41
+
42
+ # Enable escaping HTML in JSON.
43
+ config.active_support.escape_html_entities_in_json = true
44
+
45
+ # Use SQL instead of Active Record's schema dumper when creating the database.
46
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
47
+ # like if you have constraints or database-specific column types
48
+ # config.active_record.schema_format = :sql
49
+
50
+ # Enforce whitelist mode for mass assignment.
51
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
52
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
53
+ # parameters by using an attr_accessible or attr_protected declaration.
54
+ config.active_record.whitelist_attributes = true
55
+
56
+ # Enable the asset pipeline
57
+ config.assets.enabled = true
58
+
59
+ # Version of your assets, change this if you want to expire all your assets
60
+ config.assets.version = '1.0'
61
+ end
62
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Demoapp::Application.initialize!
@@ -0,0 +1,37 @@
1
+ Demoapp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
32
+ # Do not compress assets
33
+ config.assets.compress = false
34
+
35
+ # Expands the lines which load the assets
36
+ config.assets.debug = true
37
+ end