tarsus-rails 0.0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +7 -0
- data/Gemfile +2 -0
- data/README.md +4 -0
- data/Rakefile +19 -0
- data/lib/tarsus-rails.rb +1 -0
- data/lib/tarsus/rails.rb +2 -0
- data/lib/tarsus/rails/engine.rb +6 -0
- data/lib/tarsus/rails/version.rb +6 -0
- data/tarsus-rails.gemspec +23 -0
- data/test/dummy/.gitignore +16 -0
- data/test/dummy/Gemfile +47 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.keep +0 -0
- data/test/dummy/app/models/.keep +0 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +4 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/lib/tasks/.keep +0 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/vendor/assets/javascripts/.keep +0 -0
- data/test/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/test/tarsus-rails_test.rb +16 -0
- data/test/test_helper.rb +10 -0
- data/vendor/assets/javascripts/tarsus.js +403 -0
- metadata +151 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Print deprecation notices to the stderr.
|
35
|
+
config.active_support.deprecation = :stderr
|
36
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Dummy::Application.config.secret_key_base = '30f9344c9bfa49fbf510e3500b1e4ef71ed08c15271bcceb5c9ad2a22377794805aa13ad67a9329695836f0ddc6367082e28dbf53e5e69af21e6537195847cc6'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Dummy::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
+
# See how all your routes lay out with "rake routes".
|
4
|
+
|
5
|
+
# You can have the root of your site routed with "root"
|
6
|
+
# root 'welcome#index'
|
7
|
+
|
8
|
+
# Example of regular route:
|
9
|
+
# get 'products/:id' => 'catalog#view'
|
10
|
+
|
11
|
+
# Example of named route that can be invoked with purchase_url(id: product.id)
|
12
|
+
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
13
|
+
|
14
|
+
# Example resource route (maps HTTP verbs to controller actions automatically):
|
15
|
+
# resources :products
|
16
|
+
|
17
|
+
# Example resource route with options:
|
18
|
+
# resources :products do
|
19
|
+
# member do
|
20
|
+
# get 'short'
|
21
|
+
# post 'toggle'
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# collection do
|
25
|
+
# get 'sold'
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
|
29
|
+
# Example resource route with sub-resources:
|
30
|
+
# resources :products do
|
31
|
+
# resources :comments, :sales
|
32
|
+
# resource :seller
|
33
|
+
# end
|
34
|
+
|
35
|
+
# Example resource route with more complex sub-resources:
|
36
|
+
# resources :products do
|
37
|
+
# resources :comments
|
38
|
+
# resources :sales do
|
39
|
+
# get 'recent', on: :collection
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
|
43
|
+
# Example resource route with concerns:
|
44
|
+
# concern :toggleable do
|
45
|
+
# post 'toggle'
|
46
|
+
# end
|
47
|
+
# resources :posts, concerns: :toggleable
|
48
|
+
# resources :photos, concerns: :toggleable
|
49
|
+
|
50
|
+
# Example resource route within a namespace:
|
51
|
+
# namespace :admin do
|
52
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
53
|
+
# # (app/controllers/admin/products_controller.rb)
|
54
|
+
# resources :products
|
55
|
+
# end
|
56
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
File without changes
|
File without changes
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/404.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/422.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The change you wanted was rejected.</h1>
|
54
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/500.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>We're sorry, but something went wrong.</h1>
|
54
|
+
</div>
|
55
|
+
<p>If you are the application owner check the logs for more information.</p>
|
56
|
+
</body>
|
57
|
+
</html>
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TarsusRailsTest < Rails::Generators::TestCase
|
4
|
+
|
5
|
+
destination File.expand_path("../../tmp", __FILE__)
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@app = Dummy::Application
|
9
|
+
end
|
10
|
+
|
11
|
+
test "tarsus.js is found as an asset" do
|
12
|
+
assert_not_nil @app.assets["tarsus"]
|
13
|
+
assert_file "#{Tarsus::Rails::Engine.root}/vendor/assets/javascripts/tarsus.js", /0.0.1/
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
|
9
|
+
# For Generators
|
10
|
+
require 'rails/generators/test_case'
|
@@ -0,0 +1,403 @@
|
|
1
|
+
// Generated by CoffeeScript 1.6.1
|
2
|
+
(function() {
|
3
|
+
var Tarsus,
|
4
|
+
__hasProp = {}.hasOwnProperty,
|
5
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
6
|
+
|
7
|
+
Tarsus = function(Backbone) {
|
8
|
+
"use strict"; Tarsus = {};
|
9
|
+
if (typeof exports !== "undefined" && exports !== null) {
|
10
|
+
Tarsus = exports;
|
11
|
+
}
|
12
|
+
Tarsus.VERSION = "0.0.1";
|
13
|
+
Tarsus.Views = {};
|
14
|
+
Tarsus.Views.Bootstrap = {};
|
15
|
+
return Tarsus;
|
16
|
+
};
|
17
|
+
|
18
|
+
Tarsus(Backbone);
|
19
|
+
|
20
|
+
Tarsus.Views.Bootstrap.Accordion = (function(_super) {
|
21
|
+
|
22
|
+
__extends(Accordion, _super);
|
23
|
+
|
24
|
+
function Accordion() {
|
25
|
+
return Accordion.__super__.constructor.apply(this, arguments);
|
26
|
+
}
|
27
|
+
|
28
|
+
return Accordion;
|
29
|
+
|
30
|
+
})(Backbone.View);
|
31
|
+
|
32
|
+
Tarsus.Views.Bootstrap.Alert = (function(_super) {
|
33
|
+
|
34
|
+
__extends(Alert, _super);
|
35
|
+
|
36
|
+
function Alert() {
|
37
|
+
return Alert.__super__.constructor.apply(this, arguments);
|
38
|
+
}
|
39
|
+
|
40
|
+
Alert.prototype.tagName = 'div';
|
41
|
+
|
42
|
+
Alert.prototype.className = 'alert';
|
43
|
+
|
44
|
+
Alert.prototype.defaults = {
|
45
|
+
fadeIn: true
|
46
|
+
};
|
47
|
+
|
48
|
+
Alert.prototype.events = {
|
49
|
+
'close': 'close',
|
50
|
+
'closed': 'closed'
|
51
|
+
};
|
52
|
+
|
53
|
+
Alert.prototype.initialize = function(options) {
|
54
|
+
_.bindAll(this);
|
55
|
+
return this.options = _.extend(this.defaults, options);
|
56
|
+
};
|
57
|
+
|
58
|
+
Alert.prototype.render = function() {
|
59
|
+
if (this.options.fadeIn) {
|
60
|
+
this.$el.addClass('fade in');
|
61
|
+
}
|
62
|
+
if (this.options.status != null) {
|
63
|
+
this.$el.addClass('alert-' + this.options.status);
|
64
|
+
}
|
65
|
+
this.$el.append(this.closeButton());
|
66
|
+
if (this.options.title != null) {
|
67
|
+
this.$el.append(this.header());
|
68
|
+
}
|
69
|
+
if (typeof template !== "undefined" && template !== null) {
|
70
|
+
this.$el.addClass('alert-block');
|
71
|
+
this.$el.append(this.template());
|
72
|
+
} else {
|
73
|
+
this.$el.append(this.options.text);
|
74
|
+
}
|
75
|
+
this.$el.alert();
|
76
|
+
return this;
|
77
|
+
};
|
78
|
+
|
79
|
+
Alert.prototype.close = function() {
|
80
|
+
this.trigger('tarsus:alert:close');
|
81
|
+
return this;
|
82
|
+
};
|
83
|
+
|
84
|
+
Alert.prototype.closed = function() {
|
85
|
+
this.trigger('tarsus:alert:closed');
|
86
|
+
return this;
|
87
|
+
};
|
88
|
+
|
89
|
+
Alert.prototype.success = function() {
|
90
|
+
this.options.status = 'success';
|
91
|
+
return this;
|
92
|
+
};
|
93
|
+
|
94
|
+
Alert.prototype.info = function() {
|
95
|
+
this.options.status = 'info';
|
96
|
+
return this;
|
97
|
+
};
|
98
|
+
|
99
|
+
Alert.prototype.error = function() {
|
100
|
+
this.options.status = 'error';
|
101
|
+
return this;
|
102
|
+
};
|
103
|
+
|
104
|
+
Alert.prototype.closeButton = function() {
|
105
|
+
return Backbone.$('<button type="button" class="close" data-dismiss="alert">×</button>');
|
106
|
+
};
|
107
|
+
|
108
|
+
Alert.prototype.headerContainer = function() {
|
109
|
+
return Backbone.$('<h4 class="alert-heading"></h4>');
|
110
|
+
};
|
111
|
+
|
112
|
+
Alert.prototype.header = function() {
|
113
|
+
return this.headerContainer.append(this.options.title);
|
114
|
+
};
|
115
|
+
|
116
|
+
return Alert;
|
117
|
+
|
118
|
+
})(Backbone.View);
|
119
|
+
|
120
|
+
Tarsus.Views.Bootstrap.Carousel = (function(_super) {
|
121
|
+
|
122
|
+
__extends(Carousel, _super);
|
123
|
+
|
124
|
+
function Carousel() {
|
125
|
+
return Carousel.__super__.constructor.apply(this, arguments);
|
126
|
+
}
|
127
|
+
|
128
|
+
return Carousel;
|
129
|
+
|
130
|
+
})(Backbone.View);
|
131
|
+
|
132
|
+
Tarsus.Views.Bootstrap.Dropdown = (function(_super) {
|
133
|
+
|
134
|
+
__extends(Dropdown, _super);
|
135
|
+
|
136
|
+
function Dropdown() {
|
137
|
+
return Dropdown.__super__.constructor.apply(this, arguments);
|
138
|
+
}
|
139
|
+
|
140
|
+
return Dropdown;
|
141
|
+
|
142
|
+
})(Backbone.View);
|
143
|
+
|
144
|
+
Tarsus.Views.Bootstrap.Modal = (function(_super) {
|
145
|
+
|
146
|
+
__extends(Modal, _super);
|
147
|
+
|
148
|
+
function Modal() {
|
149
|
+
return Modal.__super__.constructor.apply(this, arguments);
|
150
|
+
}
|
151
|
+
|
152
|
+
Modal.prototype.tagName = 'div';
|
153
|
+
|
154
|
+
Modal.prototype.className = 'modal hide fade';
|
155
|
+
|
156
|
+
Modal.prototype.attributes = {
|
157
|
+
tabindex: -1,
|
158
|
+
style: 'outline: 0;'
|
159
|
+
};
|
160
|
+
|
161
|
+
Modal.prototype.events = {
|
162
|
+
'shown': 'shown',
|
163
|
+
'hidden': 'hidden'
|
164
|
+
};
|
165
|
+
|
166
|
+
Modal.prototype.defaults = {
|
167
|
+
bootstrap: {
|
168
|
+
backdrop: true,
|
169
|
+
keyboard: true,
|
170
|
+
show: false,
|
171
|
+
remote: false
|
172
|
+
},
|
173
|
+
noCloseButton: false
|
174
|
+
};
|
175
|
+
|
176
|
+
Modal.prototype.initialize = function(options) {
|
177
|
+
_.bindAll(this);
|
178
|
+
return this.options = _.extend(this.defaults, options);
|
179
|
+
};
|
180
|
+
|
181
|
+
Modal.prototype.render = function() {
|
182
|
+
var body, footer, footerContainer, header, headerContainer, model;
|
183
|
+
if (this.model === Backbone.Model) {
|
184
|
+
model = this.model.attributes;
|
185
|
+
}
|
186
|
+
header = this.header();
|
187
|
+
footer = this.footer();
|
188
|
+
body = Backbone.$('<div class="modal-body"></div>');
|
189
|
+
body.append(this.template(model));
|
190
|
+
if (header != null) {
|
191
|
+
headerContainer = this.headerContainer();
|
192
|
+
if (!this.options.noCloseButton) {
|
193
|
+
headerContainer.append(this.closeButton());
|
194
|
+
}
|
195
|
+
headerContainer.append(header);
|
196
|
+
this.$el.append(headerContainer);
|
197
|
+
}
|
198
|
+
this.$el.append(body);
|
199
|
+
if (footer != null) {
|
200
|
+
footerContainer = this.footerContainer();
|
201
|
+
footerContainer.append(footer);
|
202
|
+
this.$el.append(footerContainer);
|
203
|
+
}
|
204
|
+
this.$el.modal(this.options.bootstrap);
|
205
|
+
return this;
|
206
|
+
};
|
207
|
+
|
208
|
+
Modal.prototype.show = function() {
|
209
|
+
this.$el.modal('show');
|
210
|
+
this.trigger('tarsus:modal:show');
|
211
|
+
return this;
|
212
|
+
};
|
213
|
+
|
214
|
+
Modal.prototype.shown = function() {};
|
215
|
+
|
216
|
+
Modal.prototype.hide = function() {
|
217
|
+
this.$el.modal('hide');
|
218
|
+
this.trigger('tarsus:modal:hide');
|
219
|
+
return this;
|
220
|
+
};
|
221
|
+
|
222
|
+
Modal.prototype.hidden = function() {};
|
223
|
+
|
224
|
+
Modal.prototype.toggle = function() {
|
225
|
+
this.$el.modal('toggle');
|
226
|
+
this.trigger('tarsus:modal:toggle');
|
227
|
+
return this;
|
228
|
+
};
|
229
|
+
|
230
|
+
Modal.prototype.headerContainer = function() {
|
231
|
+
return Backbone.$('<div class="modal-header"></div>');
|
232
|
+
};
|
233
|
+
|
234
|
+
Modal.prototype.header = function() {
|
235
|
+
if (this.options.title != null) {
|
236
|
+
return Backbone.$('<h3>' + this.options.title + '</h3>');
|
237
|
+
}
|
238
|
+
};
|
239
|
+
|
240
|
+
Modal.prototype.closeButton = function() {
|
241
|
+
return Backbone.$('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>');
|
242
|
+
};
|
243
|
+
|
244
|
+
Modal.prototype.footerContainer = function() {
|
245
|
+
return Backbone.$('<div class="modal-footer"></div>');
|
246
|
+
};
|
247
|
+
|
248
|
+
Modal.prototype.footer = function() {};
|
249
|
+
|
250
|
+
return Modal;
|
251
|
+
|
252
|
+
})(Backbone.View);
|
253
|
+
|
254
|
+
Tarsus.Views.Bootstrap.Popover = (function(_super) {
|
255
|
+
|
256
|
+
__extends(Popover, _super);
|
257
|
+
|
258
|
+
function Popover() {
|
259
|
+
return Popover.__super__.constructor.apply(this, arguments);
|
260
|
+
}
|
261
|
+
|
262
|
+
Popover.prototype.tagName = 'a';
|
263
|
+
|
264
|
+
Popover.prototype.className = 'btn';
|
265
|
+
|
266
|
+
Popover.prototype.attributes = {
|
267
|
+
href: '#'
|
268
|
+
};
|
269
|
+
|
270
|
+
Popover.prototype.defaults = {
|
271
|
+
bootstrap: {
|
272
|
+
animation: true,
|
273
|
+
html: false,
|
274
|
+
placement: 'top',
|
275
|
+
selector: false,
|
276
|
+
trigger: 'hover focus',
|
277
|
+
delay: 0,
|
278
|
+
container: false,
|
279
|
+
title: null,
|
280
|
+
content: null
|
281
|
+
},
|
282
|
+
text: null
|
283
|
+
};
|
284
|
+
|
285
|
+
Popover.prototype.initialize = function(options) {
|
286
|
+
_.bindAll(this);
|
287
|
+
return this.options = _.extend(this.defaults, options);
|
288
|
+
};
|
289
|
+
|
290
|
+
Popover.prototype.render = function() {
|
291
|
+
this.$el.text(this.options.text);
|
292
|
+
this.$el.popover(this.options.bootstrap);
|
293
|
+
return this;
|
294
|
+
};
|
295
|
+
|
296
|
+
Popover.prototype.show = function() {
|
297
|
+
this.$el.popover('show');
|
298
|
+
this.trigger('tarsus:popover:show');
|
299
|
+
return this;
|
300
|
+
};
|
301
|
+
|
302
|
+
Popover.prototype.hide = function() {
|
303
|
+
this.$el.popover('hide');
|
304
|
+
this.trigger('tarsus:popover:hide');
|
305
|
+
return this;
|
306
|
+
};
|
307
|
+
|
308
|
+
Popover.prototype.toggle = function() {
|
309
|
+
this.$el.popover('toggle');
|
310
|
+
this.trigger('tarsus:popover:toggle');
|
311
|
+
return this;
|
312
|
+
};
|
313
|
+
|
314
|
+
Popover.prototype.destroy = function() {
|
315
|
+
this.$el.popover('destroy');
|
316
|
+
this.trigger('tarsus:popover:destroy');
|
317
|
+
return this;
|
318
|
+
};
|
319
|
+
|
320
|
+
return Popover;
|
321
|
+
|
322
|
+
})(Backbone.View);
|
323
|
+
|
324
|
+
Tarsus.Views.Bootstrap.Tabs = (function(_super) {
|
325
|
+
|
326
|
+
__extends(Tabs, _super);
|
327
|
+
|
328
|
+
function Tabs() {
|
329
|
+
return Tabs.__super__.constructor.apply(this, arguments);
|
330
|
+
}
|
331
|
+
|
332
|
+
return Tabs;
|
333
|
+
|
334
|
+
})(Backbone.View);
|
335
|
+
|
336
|
+
Tarsus.Views.Bootstrap.Tooltip = (function(_super) {
|
337
|
+
|
338
|
+
__extends(Tooltip, _super);
|
339
|
+
|
340
|
+
function Tooltip() {
|
341
|
+
return Tooltip.__super__.constructor.apply(this, arguments);
|
342
|
+
}
|
343
|
+
|
344
|
+
Tooltip.prototype.tagName = 'a';
|
345
|
+
|
346
|
+
Tooltip.prototype.attributes = {
|
347
|
+
href: '#'
|
348
|
+
};
|
349
|
+
|
350
|
+
Tooltip.prototype.defaults = {
|
351
|
+
bootstrap: {
|
352
|
+
animation: true,
|
353
|
+
html: false,
|
354
|
+
placement: 'top',
|
355
|
+
selector: false,
|
356
|
+
title: '',
|
357
|
+
trigger: 'hover focus',
|
358
|
+
delay: 0,
|
359
|
+
container: false
|
360
|
+
},
|
361
|
+
text: null
|
362
|
+
};
|
363
|
+
|
364
|
+
Tooltip.prototype.initialize = function(options) {
|
365
|
+
_.bindAll(this);
|
366
|
+
return this.options = _.extend(this.defaults, options);
|
367
|
+
};
|
368
|
+
|
369
|
+
Tooltip.prototype.render = function() {
|
370
|
+
this.$el.text(this.options.text);
|
371
|
+
this.$el.tooltip(this.options.bootstrap);
|
372
|
+
return this;
|
373
|
+
};
|
374
|
+
|
375
|
+
Tooltip.prototype.show = function() {
|
376
|
+
this.$el.tooltip('show');
|
377
|
+
this.trigger('tarsus:tooltip:show');
|
378
|
+
return this;
|
379
|
+
};
|
380
|
+
|
381
|
+
Tooltip.prototype.hide = function() {
|
382
|
+
this.$el.tooltip('hide');
|
383
|
+
this.trigger('tarsus:tooltip:hide');
|
384
|
+
return this;
|
385
|
+
};
|
386
|
+
|
387
|
+
Tooltip.prototype.toggle = function() {
|
388
|
+
this.$el.tooltip('toggle');
|
389
|
+
this.trigger('tarsus:tooltip:toggle');
|
390
|
+
return this;
|
391
|
+
};
|
392
|
+
|
393
|
+
Tooltip.prototype.destroy = function() {
|
394
|
+
this.$el.tooltip('destroy');
|
395
|
+
this.trigger('tarsus:tooltip:destroy');
|
396
|
+
return this;
|
397
|
+
};
|
398
|
+
|
399
|
+
return Tooltip;
|
400
|
+
|
401
|
+
})(Backbone.View);
|
402
|
+
|
403
|
+
}).call(this);
|