From bd1a01eb4df61b2b8abf2bcbe4799ad74a609d0c Mon Sep 17 00:00:00 2001 From: Maximilian Clarke Date: Sat, 26 Apr 2014 11:59:04 +1000 Subject: [PATCH 01/13] Upgrade to Bootstrap 3.1.1 --- .../javascripts/application.js.coffee.erb | 38 +- .../stylesheets/application.css.scss.erb | 11 +- app/assets/stylesheets/typeahead.css.scss | 49 + app/views/agents/_form.html.erb | 170 +- .../manual_event_agent/_show.html.erb | 7 +- app/views/agents/diagram.html.erb | 4 +- app/views/agents/edit.html.erb | 16 +- app/views/agents/index.html.erb | 148 +- app/views/agents/new.html.erb | 10 +- app/views/agents/show.html.erb | 54 +- app/views/devise/confirmations/new.html.erb | 18 +- app/views/devise/registrations/edit.html.erb | 51 +- app/views/devise/sessions/new.html.erb | 50 +- app/views/events/index.html.erb | 56 +- app/views/events/show.html.erb | 4 +- app/views/home/_signed_in_index.html.erb | 55 +- app/views/home/_signed_out_index.html.erb | 11 +- app/views/layouts/_messages.html.erb | 4 +- app/views/layouts/_navigation.html.erb | 135 +- app/views/layouts/application.html.erb | 22 +- app/views/logs/index.html.erb | 58 +- app/views/user_credentials/_form.html.erb | 58 +- app/views/user_credentials/index.html.erb | 10 +- app/views/user_credentials/new.html.erb | 11 +- config/environments/production.rb | 3 + .../fonts/glyphicons-halflings-regular.eot | Bin 0 -> 14079 bytes .../fonts/glyphicons-halflings-regular.svg | 229 + .../fonts/glyphicons-halflings-regular.ttf | Bin 0 -> 29512 bytes .../fonts/glyphicons-halflings-regular.woff | Bin 0 -> 23320 bytes vendor/assets/javascripts/bootstrap.js | 2049 +----- vendor/assets/javascripts/bootstrap/affix.js | 137 + vendor/assets/javascripts/bootstrap/alert.js | 88 + vendor/assets/javascripts/bootstrap/button.js | 107 + .../assets/javascripts/bootstrap/carousel.js | 205 + .../assets/javascripts/bootstrap/collapse.js | 170 + .../assets/javascripts/bootstrap/dropdown.js | 147 + vendor/assets/javascripts/bootstrap/modal.js | 243 + .../assets/javascripts/bootstrap/popover.js | 110 + .../assets/javascripts/bootstrap/scrollspy.js | 153 + vendor/assets/javascripts/bootstrap/tab.js | 125 + .../assets/javascripts/bootstrap/tooltip.js | 399 ++ .../javascripts/bootstrap/transition.js | 48 + vendor/assets/javascripts/typeahead.bundle.js | 1716 +++++ .../stylesheets/bootstrap-responsive.css | 1088 --- vendor/assets/stylesheets/bootstrap.css.scss | 5893 ----------------- vendor/assets/stylesheets/bootstrap.scss | 49 + .../assets/stylesheets/bootstrap/_alerts.scss | 67 + .../assets/stylesheets/bootstrap/_badges.scss | 55 + .../stylesheets/bootstrap/_breadcrumbs.scss | 26 + .../stylesheets/bootstrap/_button-groups.scss | 226 + .../stylesheets/bootstrap/_buttons.scss | 159 + .../stylesheets/bootstrap/_carousel.scss | 232 + .../assets/stylesheets/bootstrap/_close.scss | 35 + .../assets/stylesheets/bootstrap/_code.scss | 63 + .../bootstrap/_component-animations.scss | 29 + .../stylesheets/bootstrap/_dropdowns.scss | 213 + .../assets/stylesheets/bootstrap/_forms.scss | 436 ++ .../stylesheets/bootstrap/_glyphicons.scss | 232 + .../assets/stylesheets/bootstrap/_grid.scss | 84 + .../stylesheets/bootstrap/_input-groups.scss | 162 + .../stylesheets/bootstrap/_jumbotron.scss | 44 + .../assets/stylesheets/bootstrap/_labels.scss | 64 + .../stylesheets/bootstrap/_list-group.scss | 110 + .../assets/stylesheets/bootstrap/_media.scss | 56 + .../assets/stylesheets/bootstrap/_mixins.scss | 947 +++ .../assets/stylesheets/bootstrap/_modals.scss | 139 + .../assets/stylesheets/bootstrap/_navbar.scss | 620 ++ .../assets/stylesheets/bootstrap/_navs.scss | 242 + .../stylesheets/bootstrap/_normalize.scss | 423 ++ .../assets/stylesheets/bootstrap/_pager.scss | 55 + .../stylesheets/bootstrap/_pagination.scss | 88 + .../assets/stylesheets/bootstrap/_panels.scss | 241 + .../stylesheets/bootstrap/_popovers.scss | 133 + .../assets/stylesheets/bootstrap/_print.scss | 101 + .../stylesheets/bootstrap/_progress-bars.scss | 80 + .../bootstrap/_responsive-utilities.scss | 74 + .../stylesheets/bootstrap/_scaffolding.scss | 134 + .../assets/stylesheets/bootstrap/_tables.scss | 233 + .../assets/stylesheets/bootstrap/_theme.scss | 247 + .../stylesheets/bootstrap/_thumbnails.scss | 38 + .../stylesheets/bootstrap/_tooltip.scss | 95 + .../assets/stylesheets/bootstrap/_type.scss | 284 + .../stylesheets/bootstrap/_utilities.scss | 56 + .../stylesheets/bootstrap/_variables.scss | 833 +++ .../assets/stylesheets/bootstrap/_wells.scss | 29 + .../stylesheets/bootstrap/bootstrap.scss | 49 + .../assets/stylesheets/select2-bootstrap.css | 456 ++ 87 files changed, 12427 insertions(+), 9472 deletions(-) create mode 100644 app/assets/stylesheets/typeahead.css.scss create mode 100644 vendor/assets/fonts/glyphicons-halflings-regular.eot create mode 100644 vendor/assets/fonts/glyphicons-halflings-regular.svg create mode 100644 vendor/assets/fonts/glyphicons-halflings-regular.ttf create mode 100644 vendor/assets/fonts/glyphicons-halflings-regular.woff create mode 100644 vendor/assets/javascripts/bootstrap/affix.js create mode 100644 vendor/assets/javascripts/bootstrap/alert.js create mode 100644 vendor/assets/javascripts/bootstrap/button.js create mode 100644 vendor/assets/javascripts/bootstrap/carousel.js create mode 100644 vendor/assets/javascripts/bootstrap/collapse.js create mode 100644 vendor/assets/javascripts/bootstrap/dropdown.js create mode 100644 vendor/assets/javascripts/bootstrap/modal.js create mode 100644 vendor/assets/javascripts/bootstrap/popover.js create mode 100644 vendor/assets/javascripts/bootstrap/scrollspy.js create mode 100644 vendor/assets/javascripts/bootstrap/tab.js create mode 100644 vendor/assets/javascripts/bootstrap/tooltip.js create mode 100644 vendor/assets/javascripts/bootstrap/transition.js create mode 100644 vendor/assets/javascripts/typeahead.bundle.js delete mode 100644 vendor/assets/stylesheets/bootstrap-responsive.css delete mode 100644 vendor/assets/stylesheets/bootstrap.css.scss create mode 100644 vendor/assets/stylesheets/bootstrap.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_alerts.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_badges.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_breadcrumbs.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_button-groups.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_buttons.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_carousel.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_close.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_code.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_component-animations.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_dropdowns.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_forms.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_glyphicons.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_grid.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_input-groups.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_jumbotron.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_labels.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_list-group.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_media.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_mixins.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_modals.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_navbar.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_navs.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_normalize.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_pager.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_pagination.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_panels.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_popovers.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_print.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_progress-bars.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_responsive-utilities.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_scaffolding.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_tables.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_theme.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_thumbnails.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_tooltip.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_type.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_utilities.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_variables.scss create mode 100644 vendor/assets/stylesheets/bootstrap/_wells.scss create mode 100644 vendor/assets/stylesheets/bootstrap/bootstrap.scss create mode 100644 vendor/assets/stylesheets/select2-bootstrap.css diff --git a/app/assets/javascripts/application.js.coffee.erb b/app/assets/javascripts/application.js.coffee.erb index f635ea67..c17fcd3c 100644 --- a/app/assets/javascripts/application.js.coffee.erb +++ b/app/assets/javascripts/application.js.coffee.erb @@ -1,5 +1,6 @@ #= require jquery #= require jquery_ujs +#= require typeahead.bundle #= require bootstrap #= require select2 #= require json2 @@ -61,25 +62,36 @@ $(document).ready -> setTimeout((-> $(".flash").slideUp(-> $(".flash").remove())), 5000) # Agent Navigation + $agentNavigate = $('#agent-navigate') - $agentNavigate.typeahead( - minLength: 0, - items: 15, - source: agentNames - ).on("change", (e) -> - if agentPaths[$agentNavigate.val()] - $('#agent-navigate').closest(".navbar-search").find(".spinner").show() - navigationData = agentPaths[$agentNavigate.val()] + + # initialize typeahead listener + $agentNavigate.bind "typeahead:selected", (event, object, name) -> + item = object['value'] + $agentNavigate.typeahead('val', '') + if agentPaths[item] + $(".spinner").show() + navigationData = agentPaths[item] if !(navigationData instanceof Object) || !navigationData.method || navigationData.method == 'GET' window.location = navigationData.url || navigationData else $("").appendTo($("body")).click() - ).on("focus", (e) -> - $agentNavigate.val '' - ).on("blur", (e) -> - $agentNavigate.val '' - ) + # substring matcher for typeahead + substringMatcher = (strings)-> + findMatches = (query, callback) -> + matches = [] + substrRegex = new RegExp(query, "i") + $.each strings, (i, str) -> + matches.push value: str if substrRegex.test(str) + callback(matches.slice(0,6)) + + $agentNavigate.typeahead + minLength: 1, + highlight: true, + , + source: substringMatcher(agentNames) + # Pressing '/' selects the search box. $("body").on "keypress", (e) -> diff --git a/app/assets/stylesheets/application.css.scss.erb b/app/assets/stylesheets/application.css.scss.erb index 7ada6293..062add97 100644 --- a/app/assets/stylesheets/application.css.scss.erb +++ b/app/assets/stylesheets/application.css.scss.erb @@ -9,15 +9,13 @@ * compiled file, but it's generally better to create a new file per style scope. * *= require select2 + *= require select2-bootstrap *= require jquery.json-editor *= require rickshaw *= require_tree . *= require_self */ -$glyphicons-halflings-url: "<%= image_path "glyphicons-halflings.png" %>"; -$glyphicons-halflings-white-url: "<%= image_path "glyphicons-halflings-white.png" %>"; - @import "bootstrap"; body { padding-top: 60px; } @@ -63,6 +61,7 @@ img.odin { img.spinner { display: none; + vertical-align: bottom; } .hidden { @@ -133,4 +132,10 @@ span.not-applicable:after { position: relative; width: 940px; height: 400px; +} + +// Fix JSON Editor + +.json-editor blockquote { + font-size: 14px; } \ No newline at end of file diff --git a/app/assets/stylesheets/typeahead.css.scss b/app/assets/stylesheets/typeahead.css.scss new file mode 100644 index 00000000..bdf783e9 --- /dev/null +++ b/app/assets/stylesheets/typeahead.css.scss @@ -0,0 +1,49 @@ +.twitter-typeahead .tt-query, +.twitter-typeahead .tt-hint { + margin-bottom: 0; +} + +.tt-dropdown-menu { + min-width: 160px; + margin-top: 2px; + padding: 5px 0; + background-color: #fff; + border: 1px solid #ccc; + border: 1px solid rgba(0,0,0,.2); + *border-right-width: 2px; + *border-bottom-width: 2px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2); + -moz-box-shadow: 0 5px 10px rgba(0,0,0,.2); + box-shadow: 0 5px 10px rgba(0,0,0,.2); + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; +} + +.tt-suggestion { + display: block; + padding: 3px 20px; +} + +.tt-suggestion.tt-cursor { + color: #fff; + background-color: #0081c2; + background-image: -moz-linear-gradient(top, #0088cc, #0077b3); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3)); + background-image: -webkit-linear-gradient(top, #0088cc, #0077b3); + background-image: -o-linear-gradient(top, #0088cc, #0077b3); + background-image: linear-gradient(to bottom, #0088cc, #0077b3); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0) +} + +.tt-suggestion.tt-cursor a { + color: #fff; +} + +.tt-suggestion p { + margin: 0; +} diff --git a/app/views/agents/_form.html.erb b/app/views/agents/_form.html.erb index 6e003940..4eebfa2b 100644 --- a/app/views/agents/_form.html.erb +++ b/app/views/agents/_form.html.erb @@ -1,8 +1,6 @@ -<%= form_for(@agent, - :as => :agent, - :url => @agent.new_record? ? agents_path : agent_path(@agent), - :method => @agent.new_record? ? "POST" : "PUT") do |f| %> - <% if @agent.errors.any? %> +<% if @agent.errors.any? %> +
+

<%= pluralize(@agent.errors.count, "error") %> prohibited this Agent from being saved:

    @@ -11,75 +9,97 @@ <% end %>
- <% end %> - -
- <%= @agent.html_description unless @agent.new_record? %> -
- - - - <% if @agent.new_record? %> -
- <%= f.label :type, :class => 'control-label' %> -
- <%= f.select :type, options_for_select(Agent.types.map(&:to_s).sort.map {|type| [type.gsub(/^.*::/, ''), type] }, @agent.type), {}, :class => 'span4 select2' %> -
-
- <% end %> - -
- <%= f.label :name, :class => 'control-label' %> -
- <%= f.text_field :name, :class => 'span4' %> -
-
- -
- <%= f.label :schedule, :class => 'control-label' %> -
- <%= f.select :schedule, options_for_select(Agent::SCHEDULES.map {|s| [s.humanize.titleize, s] }, @agent.schedule), {}, :class => 'span4' %> - This type of Agent cannot be scheduled. -
-
- - - -
- <%= f.label :sources, :class => 'control-label' %> - -
- -
- <%= f.label :options, :class => 'control-label' %> -
- -
-
- -
- <%= f.submit :class => "btn btn-primary" %>
+
<% end %> + +<%= form_for(@agent, + :as => :agent, + :url => @agent.new_record? ? agents_path : agent_path(@agent), + :method => @agent.new_record? ? "POST" : "PUT") do |f| %> + +
+
+
+ + +
+ <% if @agent.new_record? %> +
+ <%= f.label :type %> + <%= f.select :type, options_for_select(Agent.types.map(&:to_s).sort.map {|type| [type.gsub(/^.*::/, ''), type] }, @agent.type), {}, :class => 'select2 form-control' %> +
+ <% end %> + +
+ <%= f.label :name %> + <%= f.text_field :name, :class => 'form-control' %> +
+ +
+ <%= f.label :schedule, :class => 'control-label' %> +
+ <%= f.select :schedule, options_for_select(Agent::SCHEDULES.map {|s| [s.humanize.titleize, s] }, @agent.schedule), {}, :class => 'form-control' %> + This type of Agent cannot be scheduled. +
+
+ + + +
+ <%= f.label :sources %> + +
+
+ + +
+
+ <%= f.label :options %> + +
+
+
+
+ +
+
+
+
+ <%= @agent.html_description unless @agent.new_record? %> +
+
+
+ +
+
+ +
+
+
+
+ +
+
+ <%= f.submit :class => "btn btn-primary" %> +
+
+ +<% end %> \ No newline at end of file diff --git a/app/views/agents/agent_views/manual_event_agent/_show.html.erb b/app/views/agents/agent_views/manual_event_agent/_show.html.erb index b2aec0e6..2e766e17 100644 --- a/app/views/agents/agent_views/manual_event_agent/_show.html.erb +++ b/app/views/agents/agent_views/manual_event_agent/_show.html.erb @@ -3,15 +3,14 @@

<%= form_tag handle_details_post_agent_path(@agent), :id => "create-event-form" do %> -
-
-
<%= submit_tag "Submit", :class => "btn btn-primary" %> -
+ <% end %>