hobo_bootstrap_ui 2.0.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ Additional UI tags for the [hobo_bootstrap theme](https://github.com/Hobo/hobo_bootstrap). Some of these tags are wrappers for the [bootstrap javascript components](twitter.github.com/bootstrap/javascript.html). Others are useful tags that are built on top of those javascript components.
2
+
3
+ This plugin also includes an implementation of `<search-results-container>`, replacing the one in `hobo_jquery_ui`.
4
+
5
+ ## Installation
6
+
7
+ rails generate hobo:install_plugin hobo_bootstrap_ui git://github.com/Hobo/hobo_bootstrap_ui.git
8
+
9
+ ## Documentation
10
+
11
+ [Tag documentation](http://cookbook.hobocentral.net/api_plugins/hobo_bootstrap_ui)
12
+
13
+ ## Versus hobo_jquery_ui
14
+
15
+ It is intended that this library will render [hobo_jquery_ui](https://github.com/Hobo/hobo_jquery_ui) and jquery-ui optional.
16
+
17
+ At the moment, you can use hobo_bootstrap_ui instead of hobo_jquery_ui if you don't mind the loss of tags such as `<name-one>`.
18
+
19
+ hobo_bootstrap_ui and hobo_jquery_ui may both be used in the same Hobo application. In the case of a conflict, the plugin loaded last will be used. `<search-results-container>` is the only current conflict, although hopefully we get bootstrap replacements for `<name-one>` and `<input for="Date">` soon.
20
+
21
+ At the momemt, Hobo requires jQuery-UI even if hobo_jquery_ui is not used. We do plan on removing that dependency soon.
22
+
23
+ ## TODO
24
+
25
+ * replace `show` and `hide` in hjq.js to make jQuery-UI optional
26
+
27
+ * implement `name-one` using bootstrap typeahead so that a Hobo application without hobo_jquery_ui is Hobo 1.3 compatible
28
+
29
+ * implement replacements for the remainder of hobo_jquery_ui's tags.
30
+
31
+
32
+
33
+ [1]: https://github.com/Hobo/hobo_bootstrap_ui/raw/master/screenshots/select_one_or_new.png
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.0.0.pre6
@@ -0,0 +1,26 @@
1
+ name = File.basename( __FILE__, '.gemspec' )
2
+ version = File.read(File.expand_path('../VERSION', __FILE__)).strip
3
+ require 'date'
4
+
5
+ Gem::Specification.new do |s|
6
+
7
+ s.authors = ['Ignacio Huerta']
8
+ s.email = 'ignacio@ihuerta.net'
9
+ s.homepage = 'https://github.com/Hobo/hobo_bootstrap_ui'
10
+ s.rubyforge_project = 'hobo'
11
+ s.summary = 'Additional UI tags for the hobo_bootstrap theme'
12
+ s.description = 'Additional UI tags for the hobo_bootstrap theme'
13
+
14
+ s.add_runtime_dependency('hobo_bootstrap', "~> 2.0.0.pre1")
15
+
16
+ s.files = `git ls-files -x #{name}/* -z`.split("\0")
17
+
18
+ s.name = name
19
+ s.version = version
20
+ s.date = Date.today.to_s
21
+
22
+ s.required_rubygems_version = ">= 1.3.6"
23
+ s.rdoc_options = ["--charset=UTF-8"]
24
+ s.require_paths = ["lib", "taglibs"]
25
+
26
+ end
@@ -0,0 +1,6 @@
1
+ require 'hobo_bootstrap_ui'
2
+ require 'rails'
3
+ module HoboBootstrapUi
4
+ class Railtie < Rails::Railtie
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ module HoboBootstrapUi
2
+
3
+ VERSION = File.read(File.expand_path('../../VERSION', __FILE__)).strip
4
+ @@root = Pathname.new File.expand_path('../..', __FILE__)
5
+ def self.root; @@root; end
6
+
7
+ EDIT_LINK_BASE = "https://github.com/Hobo/hobo/edit/bootstrap_template/hobo_bootstrap"
8
+
9
+ require 'hobo_bootstrap_ui/railtie' if defined?(Rails)
10
+
11
+ class Engine < ::Rails::Engine
12
+ end
13
+ end
Binary file
@@ -0,0 +1 @@
1
+ <include src="*"/>
@@ -0,0 +1,89 @@
1
+ <!--
2
+ The Bootstrap dialog box, aka [modal](http://twitter.github.com/bootstrap/javascript.html#modals).
3
+
4
+ All bootstrap options are supported. Use the `data-` form to adjust the options. Use a blank string for `false` and a non-blank string for true.
5
+
6
+ <modal data-backdrop="" data-keyboard="" data-show="1" data-remote="&foo_path">
7
+
8
+ The default for data-show has been changed to false. To display the dialog, set data-show="1", use a `<modal-open-button>` or use javascript (`$('#foo-modal').modal('show')`)
9
+
10
+ If you want to use `modal` as an alert box, just add content to the default param:
11
+
12
+ <modal>Warning! Foo monsters!</modal>
13
+
14
+ To use modal to contain a form, you generally want to put the buttons into the footer, requiring you to override the `modal` parameter instead.
15
+
16
+ <modal id="new-story-modal">
17
+ <modal:>
18
+ <formlet owner="project" with="&this.stories.new" update="stories" success="$('#new-story-modal').modal('hide');">
19
+ <modal-header>New Story</modal-header>
20
+ <div class="modal-body">
21
+ <field-list size="0" fields="title, body, status" />
22
+ </div>
23
+ <modal-form-footer/>
24
+ </formlet>
25
+ </modal:>
26
+ </modal>
27
+ <modal-open-button modal="new-story-modal">New Story</modal-open-button>
28
+
29
+ ### Attributes
30
+
31
+ - `data-show`, `data-backdrop`, `data-keyboard`, `data-remote`: see [Bootstrap documentation](http://twitter.github.com/bootstrap/javascript.html#modals)
32
+ - `title`: the title. You may also adjust the title via the `modal-header` param.
33
+
34
+ -->
35
+ <def tag="modal" attrs="title">
36
+ <%
37
+ attributes['data_show'] ||= false
38
+ attributes['data_rapid'] = data_rapid('modal')
39
+ %>
40
+ <div class="modal hide" tabindex="-1" role="dialog" merge-attrs param="modal">
41
+ <modal-header param><%= title %></modal-header>
42
+ <div class="modal-body" param="default"/>
43
+ <div class="modal-footer" param="modal-footer"/>
44
+ </div>
45
+ </def>
46
+
47
+ <!-- Bootstrap modal header. See `<modal>` -->
48
+ <def tag="modal-header">
49
+ <div class="modal-header">
50
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true" param="close-button">×</button>
51
+ <h3 param="default"/>
52
+ </div>
53
+ </def>
54
+
55
+ <!-- Bootstrap modal footer containing submit and cancel buttons. See `<modal>` -->
56
+ <def tag="modal-form-footer">
57
+ <div class="modal-footer" param="default">
58
+ <submit param label="&t('hobo.actions.submit', :default => 'Submit')"/>
59
+ <input type="button" param="cancel" class="btn" data-dismiss="modal" aria-hidden="true" value="&t('hobo.actions.cancel', :default => 'Cancel')"/>
60
+ </div>
61
+ </def>
62
+
63
+ <!--
64
+ When pressed, will toggle a `<modal>`.
65
+
66
+ ### Attributes
67
+ * `modal` (required): the id of a modal
68
+ * supports all button attributes
69
+
70
+ ### Example
71
+ <modal id="hello-modal">Hello!</modal>
72
+ <modal-open-button modal="hello-modal">Press Me!</modal-open-button>
73
+ -->
74
+ <def tag="modal-open-button" attrs="modal">
75
+ <a href="##{modal}" role="button" class="btn" data-toggle="modal" merge param="default"/>
76
+ </def>
77
+
78
+
79
+ <!--
80
+ Defines an `<modal>` and a `<modal-open-button>` and links the two together.
81
+
82
+ ### Attributes
83
+ * `id` (optional): the DOM id to use for the modal
84
+ -->
85
+ <def tag="modal-and-button">
86
+ <% attributes["id"]="modal-#{(rand*1000000000).to_i}" unless attributes.has_key?("id") %>
87
+ <modal-open-button modal="#{attributes['id']}" param />
88
+ <modal param merge />
89
+ </def>
@@ -0,0 +1,6 @@
1
+ <!-- implements `<search-results-container>` for hobo-rapid with `<modal>` -->
2
+ <def tag="search-results-container" attrs="title">
3
+ <modal title="&title" param="default" data-show="1" id="search-results-box">
4
+ <search-results/>
5
+ </modal>
6
+ </def>
@@ -0,0 +1,63 @@
1
+ <!-- Adds a small button to a select in order to create a new record within a modal
2
+
3
+ For example, if I want to create a new project in stories/new.dryml:
4
+
5
+ <new-page>
6
+ <form:>
7
+ <field-list:>
8
+ <project-view:><select-one-or-new/></project-view:>
9
+ </field-list:>
10
+ </form:>
11
+ </new-page>
12
+
13
+ You also need to modify the create action of the new record. projects_controller.rb:
14
+
15
+ def create
16
+ hobo_create do
17
+ if request.xhr?
18
+ @this = Story.new(:project => @project)
19
+ else
20
+ create_response
21
+ end
22
+ end
23
+ end
24
+
25
+ If you are instead in stories/edit.dryml, you need to make sure the new project is autoselected. Add a couple of lines to the previous code:
26
+
27
+ def create
28
+ hobo_create do
29
+ if request.xhr?
30
+ @this = Story.new(:project => @project)
31
+ ajax_update_response(params[:render].values, {}, {:postamble =>
32
+ "$('#select-one-or-new-Project').val(#{@project.id});"})
33
+ else
34
+ create_response
35
+ end
36
+ end
37
+ end
38
+
39
+ -->
40
+ <def tag="select-one-or-new">
41
+ <%# Partial %>
42
+ <div part="select-one-or-new" id="select-one-or-new-#{this_field}" class="pull-left">
43
+ <div class="input-append">
44
+ <select-one id="select-one-or-new-#{this_type}"/>
45
+ <%# Button that triggers the modal %>
46
+ <modal-open-button style="margin-top:-5px;" modal="myModal-#{this_field}">+</modal-open-button>
47
+ </div>
48
+ </div>
49
+
50
+ <%# Modal %>
51
+ <modal id="myModal-#{this_field}">
52
+ <modal:>
53
+ <formlet with="&this_type.new" update="select-one-or-new-#{this_field}"
54
+ complete="$('#myModal-#{this_field}').modal('hide')">
55
+ <modal-header><%= t('hobo.actions.create', :model => this_type.to_s) %></modal-header>
56
+ <div class="modal-body">
57
+ <field-list size="0"/>
58
+ </div>
59
+ <modal-form-footer/>
60
+ </formlet>
61
+ </modal:>
62
+ </modal>
63
+ </def>
@@ -0,0 +1,20 @@
1
+ /* dialog */
2
+ (function($) {
3
+ var methods = {
4
+ init: function(annotations) {
5
+ this.modal({show: !!this.data('show')});
6
+ }
7
+ };
8
+
9
+ $.fn.hjq_modal = function( method ) {
10
+
11
+ if ( methods[method] ) {
12
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
13
+ } else if ( typeof method === 'object' || ! method ) {
14
+ return methods.init.apply( this, arguments );
15
+ } else {
16
+ $.error( 'Method ' + method + ' does not exist on hjq_dialog' );
17
+ }
18
+ };
19
+
20
+ })( jQuery );
@@ -0,0 +1,2 @@
1
+ //= require_tree .
2
+
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require_tree .
3
+ */
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hobo_bootstrap_ui
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0.pre6
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Ignacio Huerta
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: hobo_bootstrap
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.0.pre1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.0.pre1
30
+ description: Additional UI tags for the hobo_bootstrap theme
31
+ email: ignacio@ihuerta.net
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - README.md
37
+ - VERSION
38
+ - hobo_bootstrap_ui.gemspec
39
+ - lib/hobo_bootstrap_ui.rb
40
+ - lib/hobo_bootstrap_ui/railtie.rb
41
+ - screenshots/select_one_or_new.png
42
+ - taglibs/hobo_bootstrap_ui.dryml
43
+ - taglibs/modal.dryml
44
+ - taglibs/overrides.dryml
45
+ - taglibs/select_one_or_new.dryml
46
+ - vendor/assets/javascripts/hobo-bootstrap-ui/hjq-modal.js
47
+ - vendor/assets/javascripts/hobo_bootstrap_ui.js
48
+ - vendor/assets/stylesheets/hobo_bootstrap_ui.css
49
+ homepage: https://github.com/Hobo/hobo_bootstrap_ui
50
+ licenses: []
51
+ post_install_message:
52
+ rdoc_options:
53
+ - --charset=UTF-8
54
+ require_paths:
55
+ - lib
56
+ - taglibs
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.3.6
69
+ requirements: []
70
+ rubyforge_project: hobo
71
+ rubygems_version: 1.8.24
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Additional UI tags for the hobo_bootstrap theme
75
+ test_files: []