tbone 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +21 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/app/assets/javascripts/backbone-rails.js.coffee +0 -0
- data/app/assets/javascripts/collections/paginated.js.coffee +76 -0
- data/app/assets/javascripts/helpers/alert_queue.js.coffee +15 -0
- data/app/assets/javascripts/helpers/layout.js.coffee +13 -0
- data/app/assets/javascripts/models/.gitkeep +0 -0
- data/app/assets/javascripts/models/token.js.coffee +4 -0
- data/app/assets/javascripts/tbone.js.coffee +14 -0
- data/app/assets/javascripts/templates/.gitkeep +0 -0
- data/app/assets/javascripts/templates/common/alert_message.jst.hamljs +4 -0
- data/app/assets/javascripts/templates/common/confirm.jst.hamljs +10 -0
- data/app/assets/javascripts/templates/common/pager.jst.hamljs +32 -0
- data/app/assets/javascripts/views/.gitkeep +0 -0
- data/app/assets/javascripts/views/common/alert_message_view.js.coffee +21 -0
- data/app/assets/javascripts/views/common/alert_view.js.coffee +36 -0
- data/app/assets/javascripts/views/common/confirm_view.js.coffee +33 -0
- data/app/assets/javascripts/views/common/form_view.js.coffee +60 -0
- data/app/assets/javascripts/views/common/pager_view.js.coffee +19 -0
- data/app/assets/javascripts/views/tokens/show_view.js.coffee +13 -0
- data/app/controllers/home_controller.rb +4 -0
- data/app/controllers/tokens_controller.rb +5 -0
- data/app/helpers/tbone_helper.rb +5 -0
- data/app/views/home/index.html.haml +1 -0
- data/app/views/tokens/show.json.rabl +4 -0
- data/config/routes.rb +4 -0
- data/lib/generators/tbone/install/install_generator.rb +17 -0
- data/lib/generators/tbone/install/templates/application.json.rabl +1 -0
- data/lib/generators/tbone/install/templates/requirejs.yml +27 -0
- data/lib/tbone/engine.rb +41 -0
- data/lib/tbone.rb +3 -0
- data/tbone.gemspec +84 -0
- data/test/helper.rb +18 -0
- data/test/test_tbone.rb +7 -0
- metadata +122 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rdoc"
|
10
|
+
gem "bundler"
|
11
|
+
gem "jeweler"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.8.4)
|
6
|
+
bundler (~> 1.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rdoc
|
10
|
+
json (1.7.3)
|
11
|
+
rake (0.9.2.2)
|
12
|
+
rdoc (3.12)
|
13
|
+
json (~> 1.4)
|
14
|
+
|
15
|
+
PLATFORMS
|
16
|
+
ruby
|
17
|
+
|
18
|
+
DEPENDENCIES
|
19
|
+
bundler
|
20
|
+
jeweler
|
21
|
+
rdoc
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Pavel Tatarsky
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= tbone
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to tbone
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2012 Pavel Tatarsky. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "tbone"
|
18
|
+
gem.homepage = "http://github.com/vintikzzz/tbone"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Library for mixing together requirejs backbone and twitter bootstrap}
|
21
|
+
gem.description = %Q{Library for mixing together requirejs backbone and twitter bootstrap}
|
22
|
+
gem.email = "fazzzenda@mail.ru"
|
23
|
+
gem.authors = ["Pavel Tatarsky"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
36
|
+
|
37
|
+
require 'rdoc/task'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "tbone #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
File without changes
|
@@ -0,0 +1,76 @@
|
|
1
|
+
define ['backbone'], (Backbone) ->
|
2
|
+
class PaginatedCollection extends Backbone.Collection
|
3
|
+
constructor: (args) ->
|
4
|
+
super(this.parse(args))
|
5
|
+
|
6
|
+
initialize: ->
|
7
|
+
# _.bindAll this, "parse", "url", "pageInfo", "nextPage", "previousPage"
|
8
|
+
@page = 1
|
9
|
+
@perPage ||= 10
|
10
|
+
this.on('add', (m) ->
|
11
|
+
this.fetch()
|
12
|
+
this)
|
13
|
+
this.on('remove', (m) ->
|
14
|
+
if this.length == 0 and @page > 1
|
15
|
+
@page++
|
16
|
+
this.fetch()
|
17
|
+
this)
|
18
|
+
|
19
|
+
fetch: (options) ->
|
20
|
+
options ||= {}
|
21
|
+
@trigger "fetching"
|
22
|
+
self = this
|
23
|
+
success = options.success
|
24
|
+
options.success = (resp) ->
|
25
|
+
self.trigger "fetched"
|
26
|
+
success self, resp if success
|
27
|
+
|
28
|
+
Backbone.Collection::fetch.call this, options
|
29
|
+
|
30
|
+
setPage: (num) ->
|
31
|
+
@page = num
|
32
|
+
this.fetch()
|
33
|
+
|
34
|
+
|
35
|
+
parse: (resp) ->
|
36
|
+
@page = resp.current_page
|
37
|
+
@perPage = resp.per_page
|
38
|
+
@total = resp.total_items
|
39
|
+
resp.items
|
40
|
+
|
41
|
+
url: ->
|
42
|
+
@baseUrl + "?" + $.param(
|
43
|
+
page: @page
|
44
|
+
)
|
45
|
+
|
46
|
+
pageInfo: ->
|
47
|
+
info =
|
48
|
+
total: @total
|
49
|
+
page: @page
|
50
|
+
perPage: @perPage
|
51
|
+
pages: Math.ceil(@total / @perPage)
|
52
|
+
prev: false
|
53
|
+
next: false
|
54
|
+
|
55
|
+
max = Math.min(@total, @page * @perPage)
|
56
|
+
max = @total if @total is @pages * @perPage
|
57
|
+
info.range = [ (@page - 1) * @perPage + 1, max ]
|
58
|
+
info.prev = @page - 1 if @page > 1
|
59
|
+
info.next = @page + 1 if @page < info.pages
|
60
|
+
info
|
61
|
+
|
62
|
+
toJSON: ->
|
63
|
+
data = {}
|
64
|
+
data['items'] = super
|
65
|
+
data['pageInfo'] = this.pageInfo()
|
66
|
+
data
|
67
|
+
|
68
|
+
nextPage: ->
|
69
|
+
return false unless @pageInfo().next
|
70
|
+
@page = @page + 1
|
71
|
+
@fetch()
|
72
|
+
|
73
|
+
previousPage: ->
|
74
|
+
return false unless @pageInfo().prev
|
75
|
+
@page = @page - 1
|
76
|
+
@fetch()
|
@@ -0,0 +1,15 @@
|
|
1
|
+
define [
|
2
|
+
'jquery'
|
3
|
+
'backbone'
|
4
|
+
'bootstrap'
|
5
|
+
], ($, Backbone, App) ->
|
6
|
+
class AlertQueue extends Backbone.Collection
|
7
|
+
|
8
|
+
add: (obj) ->
|
9
|
+
obj['shown'] = false
|
10
|
+
super obj
|
11
|
+
|
12
|
+
clear: ->
|
13
|
+
m.destroy() for m in @models when m? and m.get('shown') is true
|
14
|
+
|
15
|
+
App.Helpers.AlertQueue = new AlertQueue()
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
define [
|
3
|
+
'jquery'
|
4
|
+
'backbone'
|
5
|
+
'bootstrap'
|
6
|
+
], ($, Backbone, App) ->
|
7
|
+
class Layout
|
8
|
+
setContent: (content) ->
|
9
|
+
do @currentContent.close if @currentContent?
|
10
|
+
@currentContent = content
|
11
|
+
($ '#content').html content.render().el
|
12
|
+
|
13
|
+
App.Helpers.Layout = new Layout
|
File without changes
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#modal-from-dom.modal.hide.fade
|
2
|
+
.modal-header
|
3
|
+
%a.close{href: "#"} ×
|
4
|
+
%h3 Delete
|
5
|
+
.modal-body
|
6
|
+
%p You are about to delete this post, this procedure is irreversible.
|
7
|
+
%p Do you want to proceed?
|
8
|
+
.modal-footer
|
9
|
+
%a.btn.danger.yes Yes
|
10
|
+
%a.btn.secondary.no No
|
@@ -0,0 +1,32 @@
|
|
1
|
+
- var pages = [];
|
2
|
+
- for(var i = 1; i <= pageInfo.pages; i++) {
|
3
|
+
- var page = {}
|
4
|
+
- page['url'] = urlPrefix + i
|
5
|
+
- page['num'] = i
|
6
|
+
- page['class'] = null
|
7
|
+
- if(i == pageInfo.page) page['class'] = 'active'
|
8
|
+
- pages.push(page)
|
9
|
+
- }
|
10
|
+
- function makeArrow(data, urlPrefix) {
|
11
|
+
- var res = {}
|
12
|
+
- if(data == false) {
|
13
|
+
- res['class'] = 'disabled'
|
14
|
+
- res['url'] = '#'
|
15
|
+
- } else {
|
16
|
+
- res['class'] = null
|
17
|
+
- res['url'] = urlPrefix + data
|
18
|
+
- }
|
19
|
+
- return res
|
20
|
+
- }
|
21
|
+
- var prev = makeArrow(pageInfo.prev, urlPrefix)
|
22
|
+
- var next = makeArrow(pageInfo.next, urlPrefix)
|
23
|
+
:if pageInfo.pages > 1
|
24
|
+
.pagination
|
25
|
+
%ul
|
26
|
+
%li{class: prev['class']}
|
27
|
+
%a{href: prev['url']} «
|
28
|
+
:each page in pages
|
29
|
+
%li{class: page['class']}
|
30
|
+
%a{href: page['url']}= page['num']
|
31
|
+
%li{class: next['class']}
|
32
|
+
%a{href: next['url']} »
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
define [
|
2
|
+
'jquery'
|
3
|
+
'backbone'
|
4
|
+
'bootstrap'
|
5
|
+
'templates/common/alert_message'
|
6
|
+
], ($, Backbone, App) ->
|
7
|
+
|
8
|
+
class App.Views.Common.AlertMessageView extends Backbone.View
|
9
|
+
template: JST["templates/common/alert_message"]
|
10
|
+
|
11
|
+
events: ->
|
12
|
+
'click .close': 'destroy'
|
13
|
+
|
14
|
+
render: ->
|
15
|
+
$(@el).html(@template(@model.toJSON()))
|
16
|
+
@model.set('shown', true)
|
17
|
+
return this
|
18
|
+
|
19
|
+
destroy: ->
|
20
|
+
@model.destroy()
|
21
|
+
@remove()
|
@@ -0,0 +1,36 @@
|
|
1
|
+
define [
|
2
|
+
'jquery'
|
3
|
+
'backbone'
|
4
|
+
'bootstrap'
|
5
|
+
'helpers/alert_queue'
|
6
|
+
'views/common/alert_message_view'
|
7
|
+
], ($, Backbone, App, AlertQueue, AlertMessageView) ->
|
8
|
+
|
9
|
+
class App.Views.Common.AlertView extends Backbone.View
|
10
|
+
addErrorAlert: (message) ->
|
11
|
+
@addAlertMessage('error', message)
|
12
|
+
|
13
|
+
addSuccessAlert: (message) ->
|
14
|
+
@addAlertMessage('success', message)
|
15
|
+
|
16
|
+
addInfoAlert: (message) ->
|
17
|
+
@addAlertMessage('info', message)
|
18
|
+
|
19
|
+
addAlertMessage: (type, message) ->
|
20
|
+
AlertQueue.add({type: type, message: message})
|
21
|
+
|
22
|
+
renderAlerts: ->
|
23
|
+
alert = @$el.find('#alert')
|
24
|
+
if alert.length == 0
|
25
|
+
alert = $('<div id="alert" />')
|
26
|
+
@$el.prepend(alert)
|
27
|
+
alert.html('')
|
28
|
+
|
29
|
+
addMessage = (m) ->
|
30
|
+
view = new AlertMessageView({model: m})
|
31
|
+
alert.append(view.render().el)
|
32
|
+
|
33
|
+
addMessage m for m in AlertQueue.models
|
34
|
+
|
35
|
+
close: ->
|
36
|
+
do AlertQueue.clear
|
@@ -0,0 +1,33 @@
|
|
1
|
+
define [
|
2
|
+
'jquery'
|
3
|
+
'backbone'
|
4
|
+
'bootstrap'
|
5
|
+
'templates/common/confirm'
|
6
|
+
], ($, Backbone, App) ->
|
7
|
+
|
8
|
+
class App.Views.Common.ConfirmView extends Backbone.View
|
9
|
+
template: JST["templates/common/confirm"]
|
10
|
+
|
11
|
+
events:
|
12
|
+
"click .yes": "accept"
|
13
|
+
"click .close": "reject"
|
14
|
+
"click .no": "reject"
|
15
|
+
|
16
|
+
render: ->
|
17
|
+
@modal = $(@template())
|
18
|
+
$(@el).html(@modal)
|
19
|
+
@modal.modal({ backdrop: true }).modal('show')
|
20
|
+
return this
|
21
|
+
|
22
|
+
accept: ->
|
23
|
+
@modal.modal('hide')
|
24
|
+
t = this
|
25
|
+
setTimeout( ->
|
26
|
+
t.trigger('accept')
|
27
|
+
, 500
|
28
|
+
)
|
29
|
+
|
30
|
+
reject: ->
|
31
|
+
@modal.modal('hide')
|
32
|
+
|
33
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
define [
|
2
|
+
'jquery'
|
3
|
+
'backbone'
|
4
|
+
'bootstrap'
|
5
|
+
'views/common/alert_view'
|
6
|
+
], ($, Backbone, App, AlertView) ->
|
7
|
+
|
8
|
+
class App.Views.Common.FormView extends AlertView
|
9
|
+
events:
|
10
|
+
"submit": "save"
|
11
|
+
|
12
|
+
initialize: ->
|
13
|
+
@model.on("change:errors", @renderErrors, this)
|
14
|
+
|
15
|
+
cleanErrors: ->
|
16
|
+
@form.find(".error").removeClass("error")
|
17
|
+
@form.find(".help-block").remove()
|
18
|
+
|
19
|
+
save: (e) ->
|
20
|
+
e.preventDefault()
|
21
|
+
e.stopPropagation()
|
22
|
+
@model.unset("errors", silent: true)
|
23
|
+
@model.save(null,
|
24
|
+
success: (e) =>
|
25
|
+
@success(e)
|
26
|
+
|
27
|
+
error: (e, jqXHR) =>
|
28
|
+
@error(e, jqXHR)
|
29
|
+
)
|
30
|
+
|
31
|
+
close: ->
|
32
|
+
super
|
33
|
+
@model.off("change:errors", @renderErrors, this)
|
34
|
+
@remove()
|
35
|
+
@off()
|
36
|
+
|
37
|
+
error: (e, jqXHR) ->
|
38
|
+
@model.set({errors: $.parseJSON(jqXHR.responseText)})
|
39
|
+
|
40
|
+
markErrorField: (name, error) ->
|
41
|
+
field = @form.find(":input[name=" + name + "]")
|
42
|
+
field.parent().append("<div class='help-block'>" + error + "</div>")
|
43
|
+
field.parent().parent().addClass("error")
|
44
|
+
|
45
|
+
renderErrors: ->
|
46
|
+
@errors = @model.get('errors')
|
47
|
+
@form = this.$el.find("form")
|
48
|
+
@cleanErrors()
|
49
|
+
if @errors?
|
50
|
+
if @errors.error?
|
51
|
+
@addErrorAlert(@errors.error)
|
52
|
+
@renderAlerts()
|
53
|
+
@markErrorField(name, error) for name, error of @errors
|
54
|
+
return this
|
55
|
+
|
56
|
+
render: ->
|
57
|
+
$(@el).html(@template(@model.toJSON() ))
|
58
|
+
@renderAlerts()
|
59
|
+
this.$("form").backboneLink(@model)
|
60
|
+
return this
|
@@ -0,0 +1,19 @@
|
|
1
|
+
define [
|
2
|
+
'jquery'
|
3
|
+
'backbone'
|
4
|
+
'bootstrap'
|
5
|
+
'views/common/alert_view'
|
6
|
+
'templates/common/pager'
|
7
|
+
], ($, Backbone, App, AlertView) ->
|
8
|
+
|
9
|
+
class App.Views.Common.PagerView extends AlertView
|
10
|
+
template: JST["templates/common/pager"]
|
11
|
+
|
12
|
+
initialize: ->
|
13
|
+
@collection.on('add', @render, this)
|
14
|
+
@collection.on('remove', @render, this)
|
15
|
+
|
16
|
+
render: ->
|
17
|
+
super
|
18
|
+
$(@el).html(@template({pageInfo: @collection.toJSON().pageInfo, urlPrefix: @options.urlPrefix}))
|
19
|
+
return this
|
@@ -0,0 +1,13 @@
|
|
1
|
+
define [
|
2
|
+
'jquery'
|
3
|
+
'backbone'
|
4
|
+
'bootstrap'
|
5
|
+
], ($, Backbone, App) ->
|
6
|
+
class App.Views.Tokens.ShowView extends Backbone.View
|
7
|
+
initialize: ->
|
8
|
+
@model.set('token', $('meta[name="csrf-token"]').attr('content'))
|
9
|
+
@model.on('change', @render, this)
|
10
|
+
|
11
|
+
render: ->
|
12
|
+
$('meta[name="csrf-token"]').attr('content', @model.get('token'))
|
13
|
+
return this
|
@@ -0,0 +1 @@
|
|
1
|
+
#content
|
data/config/routes.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Tbone
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
|
+
desc "This generator installs T-bone"
|
9
|
+
def copy_requirejs_config
|
10
|
+
copy_file "requirejs.yml", "config/requirejs.yml"
|
11
|
+
end
|
12
|
+
def copy_application_rabl_view
|
13
|
+
copy_file "application.json.rabl", "app/views/application.json.rabl"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
object false
|
@@ -0,0 +1,27 @@
|
|
1
|
+
modules:
|
2
|
+
- name: 'application'
|
3
|
+
priority: ['application']
|
4
|
+
shim:
|
5
|
+
bootstrap:
|
6
|
+
- 'twitter/bootstrap/bootstrap-transition'
|
7
|
+
- 'twitter/bootstrap/bootstrap-alert'
|
8
|
+
- 'twitter/bootstrap/bootstrap-modal'
|
9
|
+
- 'twitter/bootstrap/bootstrap-dropdown'
|
10
|
+
- 'twitter/bootstrap/bootstrap-scrollspy'
|
11
|
+
- 'twitter/bootstrap/bootstrap-tab'
|
12
|
+
- 'twitter/bootstrap/bootstrap-tooltip'
|
13
|
+
- 'twitter/bootstrap/bootstrap-popover'
|
14
|
+
- 'twitter/bootstrap/bootstrap-button'
|
15
|
+
- 'twitter/bootstrap/bootstrap-collapse'
|
16
|
+
- 'twitter/bootstrap/bootstrap-carousel'
|
17
|
+
- 'twitter/bootstrap/bootstrap-typeahead'
|
18
|
+
- 'i18n'
|
19
|
+
- 'i18n/translations'
|
20
|
+
backbone:
|
21
|
+
deps: ['underscore', 'jquery']
|
22
|
+
exports: 'Backbone'
|
23
|
+
|
24
|
+
backbone_rails_sync: ['backbone']
|
25
|
+
backbone_datalink: ['backbone']
|
26
|
+
backbone-rails: ['backbone', 'backbone_rails_sync', 'backbone_datalink']
|
27
|
+
wrap: true
|
data/lib/tbone/engine.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rails'
|
2
|
+
module Tbone
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
initializer "tbone" do |app|
|
5
|
+
conf = {
|
6
|
+
'shim' => {
|
7
|
+
'backbone' => {
|
8
|
+
'deps' => ['underscore', 'jquery'],
|
9
|
+
'exports' => 'Backbone'
|
10
|
+
},
|
11
|
+
'backbone_rails_sync' => ['backbone'],
|
12
|
+
'backbone_datalink' => ['backbone'],
|
13
|
+
'backbone-rails' => ['backbone', 'backbone_rails_sync', 'backbone_datalink']
|
14
|
+
},
|
15
|
+
'wrap' => true
|
16
|
+
}
|
17
|
+
jquery_plugs = [
|
18
|
+
'bootstrap-transition',
|
19
|
+
'bootstrap-alert',
|
20
|
+
'bootstrap-modal',
|
21
|
+
'bootstrap-dropdown',
|
22
|
+
'bootstrap-scrollspy',
|
23
|
+
'bootstrap-tab',
|
24
|
+
'bootstrap-tooltip',
|
25
|
+
'bootstrap-popover',
|
26
|
+
'bootstrap-button',
|
27
|
+
'bootstrap-collapse',
|
28
|
+
'bootstrap-carousel',
|
29
|
+
'bootstrap-typeahead'
|
30
|
+
]
|
31
|
+
conf['paths'] = {}
|
32
|
+
jquery_plugs.each { |e|
|
33
|
+
conf['paths'][e] = "twitter/bootstrap/#{e}"
|
34
|
+
conf['shim'][e] = ['jquery']
|
35
|
+
}
|
36
|
+
conf['shim']['bootstrap-popover'] << 'bootstrap-tooltip'
|
37
|
+
conf['shim']['bootstrap'] = jquery_plugs
|
38
|
+
app.config.requirejs.user_config.deep_merge!(conf)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/tbone.rb
ADDED
data/tbone.gemspec
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{tbone}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = [%q{Pavel Tatarsky}]
|
12
|
+
s.date = %q{2012-06-24}
|
13
|
+
s.description = %q{Library for mixing together requirejs backbone and twitter bootstrap}
|
14
|
+
s.email = %q{fazzzenda@mail.ru}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"app/assets/javascripts/backbone-rails.js.coffee",
|
28
|
+
"app/assets/javascripts/collections/paginated.js.coffee",
|
29
|
+
"app/assets/javascripts/helpers/alert_queue.js.coffee",
|
30
|
+
"app/assets/javascripts/helpers/layout.js.coffee",
|
31
|
+
"app/assets/javascripts/models/.gitkeep",
|
32
|
+
"app/assets/javascripts/models/token.js.coffee",
|
33
|
+
"app/assets/javascripts/tbone.js.coffee",
|
34
|
+
"app/assets/javascripts/templates/.gitkeep",
|
35
|
+
"app/assets/javascripts/templates/common/alert_message.jst.hamljs",
|
36
|
+
"app/assets/javascripts/templates/common/confirm.jst.hamljs",
|
37
|
+
"app/assets/javascripts/templates/common/pager.jst.hamljs",
|
38
|
+
"app/assets/javascripts/views/.gitkeep",
|
39
|
+
"app/assets/javascripts/views/common/alert_message_view.js.coffee",
|
40
|
+
"app/assets/javascripts/views/common/alert_view.js.coffee",
|
41
|
+
"app/assets/javascripts/views/common/confirm_view.js.coffee",
|
42
|
+
"app/assets/javascripts/views/common/form_view.js.coffee",
|
43
|
+
"app/assets/javascripts/views/common/pager_view.js.coffee",
|
44
|
+
"app/assets/javascripts/views/tokens/show_view.js.coffee",
|
45
|
+
"app/controllers/home_controller.rb",
|
46
|
+
"app/controllers/tokens_controller.rb",
|
47
|
+
"app/helpers/tbone_helper.rb",
|
48
|
+
"app/views/home/index.html.haml",
|
49
|
+
"app/views/tokens/show.json.rabl",
|
50
|
+
"config/routes.rb",
|
51
|
+
"lib/generators/tbone/install/install_generator.rb",
|
52
|
+
"lib/generators/tbone/install/templates/application.json.rabl",
|
53
|
+
"lib/generators/tbone/install/templates/requirejs.yml",
|
54
|
+
"lib/tbone.rb",
|
55
|
+
"lib/tbone/engine.rb",
|
56
|
+
"tbone.gemspec",
|
57
|
+
"test/helper.rb",
|
58
|
+
"test/test_tbone.rb"
|
59
|
+
]
|
60
|
+
s.homepage = %q{http://github.com/vintikzzz/tbone}
|
61
|
+
s.licenses = [%q{MIT}]
|
62
|
+
s.require_paths = [%q{lib}]
|
63
|
+
s.rubygems_version = %q{1.8.6}
|
64
|
+
s.summary = %q{Library for mixing together requirejs backbone and twitter bootstrap}
|
65
|
+
|
66
|
+
if s.respond_to? :specification_version then
|
67
|
+
s.specification_version = 3
|
68
|
+
|
69
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
70
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
71
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
72
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
73
|
+
else
|
74
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
75
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
76
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
77
|
+
end
|
78
|
+
else
|
79
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
80
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
81
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'tbone'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
data/test/test_tbone.rb
ADDED
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tbone
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Pavel Tatarsky
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rdoc
|
16
|
+
requirement: &70175714931020 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70175714931020
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bundler
|
27
|
+
requirement: &70175714940060 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70175714940060
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: jeweler
|
38
|
+
requirement: &70175714937180 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70175714937180
|
47
|
+
description: Library for mixing together requirejs backbone and twitter bootstrap
|
48
|
+
email: fazzzenda@mail.ru
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files:
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.rdoc
|
54
|
+
files:
|
55
|
+
- .document
|
56
|
+
- Gemfile
|
57
|
+
- Gemfile.lock
|
58
|
+
- LICENSE.txt
|
59
|
+
- README.rdoc
|
60
|
+
- Rakefile
|
61
|
+
- VERSION
|
62
|
+
- app/assets/javascripts/backbone-rails.js.coffee
|
63
|
+
- app/assets/javascripts/collections/paginated.js.coffee
|
64
|
+
- app/assets/javascripts/helpers/alert_queue.js.coffee
|
65
|
+
- app/assets/javascripts/helpers/layout.js.coffee
|
66
|
+
- app/assets/javascripts/models/.gitkeep
|
67
|
+
- app/assets/javascripts/models/token.js.coffee
|
68
|
+
- app/assets/javascripts/tbone.js.coffee
|
69
|
+
- app/assets/javascripts/templates/.gitkeep
|
70
|
+
- app/assets/javascripts/templates/common/alert_message.jst.hamljs
|
71
|
+
- app/assets/javascripts/templates/common/confirm.jst.hamljs
|
72
|
+
- app/assets/javascripts/templates/common/pager.jst.hamljs
|
73
|
+
- app/assets/javascripts/views/.gitkeep
|
74
|
+
- app/assets/javascripts/views/common/alert_message_view.js.coffee
|
75
|
+
- app/assets/javascripts/views/common/alert_view.js.coffee
|
76
|
+
- app/assets/javascripts/views/common/confirm_view.js.coffee
|
77
|
+
- app/assets/javascripts/views/common/form_view.js.coffee
|
78
|
+
- app/assets/javascripts/views/common/pager_view.js.coffee
|
79
|
+
- app/assets/javascripts/views/tokens/show_view.js.coffee
|
80
|
+
- app/controllers/home_controller.rb
|
81
|
+
- app/controllers/tokens_controller.rb
|
82
|
+
- app/helpers/tbone_helper.rb
|
83
|
+
- app/views/home/index.html.haml
|
84
|
+
- app/views/tokens/show.json.rabl
|
85
|
+
- config/routes.rb
|
86
|
+
- lib/generators/tbone/install/install_generator.rb
|
87
|
+
- lib/generators/tbone/install/templates/application.json.rabl
|
88
|
+
- lib/generators/tbone/install/templates/requirejs.yml
|
89
|
+
- lib/tbone.rb
|
90
|
+
- lib/tbone/engine.rb
|
91
|
+
- tbone.gemspec
|
92
|
+
- test/helper.rb
|
93
|
+
- test/test_tbone.rb
|
94
|
+
homepage: http://github.com/vintikzzz/tbone
|
95
|
+
licenses:
|
96
|
+
- MIT
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
hash: 1484685674064663674
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 1.8.6
|
119
|
+
signing_key:
|
120
|
+
specification_version: 3
|
121
|
+
summary: Library for mixing together requirejs backbone and twitter bootstrap
|
122
|
+
test_files: []
|