diff --git a/Gemfile b/Gemfile index decb4e97..afa2f701 100644 --- a/Gemfile +++ b/Gemfile @@ -18,14 +18,14 @@ gem 'rmagick' group :assets do gem 'sass-rails', '~> 3.2.3' gem 'less-rails' - gem 'less-rails-fontawesome' + #gem 'less-rails-fontawesome' gem 'coffee-rails', '~> 3.2.1' + #gem 'bootplus-rails' #gem 'twitter-bootstrap-rails' - gem 'bootplus-rails' # See https://github.com/sstephenson/execjs#readme for more supported runtimes - gem 'therubyracer', :platform => :ruby + gem 'therubyracer', '~> 0.12.1', :platform => :ruby gem 'uglifier', '>= 1.0.3' end diff --git a/Gemfile.lock b/Gemfile.lock index b31028f1..cecf9b7f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,7 +34,6 @@ GEM json (~> 1.4) nokogiri (>= 1.4.4) uuidtools (~> 2.1) - bootplus-rails (1.0.0) bson (1.6.0) bson_ext (1.6.0) bson (= 1.6.0) @@ -49,7 +48,7 @@ GEM coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.7.0) + coffee-script-source (1.6.3) commonjs (0.2.7) database_cleaner (1.2.0) erubis (2.7.0) @@ -74,8 +73,6 @@ GEM less-rails (2.4.2) actionpack (>= 3.1) less (~> 2.4.0) - less-rails-fontawesome (0.8.0) - less-rails (~> 2.4.2) libv8 (3.16.14.3) mail (2.5.4) mime-types (~> 1.16) @@ -162,19 +159,17 @@ PLATFORMS DEPENDENCIES aws-sdk (~> 1.3.4) - bootplus-rails bson_ext (= 1.6.0) coffee-rails (~> 3.2.1) database_cleaner factory_girl_rails jquery-rails less-rails - less-rails-fontawesome mongo (= 1.6.0) mongoid mongoid-paperclip rails (= 3.2.13) rmagick sass-rails (~> 3.2.3) - therubyracer + therubyracer (~> 0.12.1) uglifier (>= 1.0.3) diff --git a/app/assets/images/card-headers/hero.jpg b/app/assets/images/card-headers/hero.jpg index 5ac3a1e6..9ae0a470 100644 Binary files a/app/assets/images/card-headers/hero.jpg and b/app/assets/images/card-headers/hero.jpg differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 042f2f95..9097d830 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -12,5 +12,4 @@ // //= require jquery //= require jquery_ujs -//= require bootplus/bootstrap //= require_tree . diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js.coffee deleted file mode 100644 index c9404a8e..00000000 --- a/app/assets/javascripts/bootstrap.js.coffee +++ /dev/null @@ -1,4 +0,0 @@ -jQuery -> - $("a[rel=popover]").popover() - $(".tooltip").tooltip() - $("a[rel=tooltip]").tooltip() \ No newline at end of file diff --git a/app/assets/javascripts/generators.js.coffee b/app/assets/javascripts/generators.js.coffee index 90172169..94b745f3 100644 --- a/app/assets/javascripts/generators.js.coffee +++ b/app/assets/javascripts/generators.js.coffee @@ -2,7 +2,7 @@ $(document).ready -> # Character name generator $('.character_name_generator').click -> - target = $(this).parent().find '.text_field' + target = $(this).closest('.row').find('input[type=text]') $.ajax dataType: 'text' url: '/generate/character/name' @@ -12,7 +12,7 @@ $(document).ready -> # Character age generator $('.character_age_generator').click -> - target = $(this).parent().find '.text_field' + target = $(this).closest('.row').find('input[type=text]') $.ajax dataType: 'text' url: '/generate/character/age' @@ -22,7 +22,7 @@ $(document).ready -> # Location name generator $('.location_name_generator').click -> - target = $(this).parent().find '.text_field' + target = $(this).closest('.row').find('input[type=text]') $.ajax dataType: 'text' url: '/generate/location/name' diff --git a/app/assets/javascripts/pickers.js.coffee b/app/assets/javascripts/pickers.js.coffee index 22925373..2268a4a5 100644 --- a/app/assets/javascripts/pickers.js.coffee +++ b/app/assets/javascripts/pickers.js.coffee @@ -1,4 +1,4 @@ $(document).ready -> $('.dropdown-picker li a').click -> val = $(this).text() - $(this).closest('.controls').find('input').val(val) + $(this).closest('.row').find('input[type=text]').val(val) diff --git a/app/assets/javascripts/tabs.js.coffee b/app/assets/javascripts/tabs.js.coffee index 438a6b4b..5e351f94 100644 --- a/app/assets/javascripts/tabs.js.coffee +++ b/app/assets/javascripts/tabs.js.coffee @@ -1,15 +1,16 @@ $(document).ready -> # Define function to close all open tabs then open a specific one show_tab = (tab_name) -> + $('.' + tab_name + '_section').closest('.card').find('.card-heading').text(tab_name) $('.tab').removeClass 'active' $('#show_' + tab_name).parent().addClass 'active' $('.section').hide() - $('.' + tab_name + '_section').css('visibility', 'visible').hide().fadeIn 'fast' + $('.' + tab_name + '_section').removeClass('hidden').hide().fadeIn 'fast' # Define function to show content tabs show_content_tab = (tab_name) -> $('.content-section').hide() - $('.' + tab_name + '_section').css('visibility', 'visible').hide().fadeIn 'fast' + $('.' + tab_name + '_section').removeClass('hidden').hide().fadeIn 'fast' # Enable tab functionality on a whitelist of tab names list_of_valid_tabs = [ @@ -22,6 +23,9 @@ $(document).ready -> $('#show_' + tab).click -> show_tab tab + $('.expand-all').click -> + $('.section').removeClass('hidden').show() + # Enable content tab functionality for whitelisted content types list_of_content_tabs = [ 'characters', 'equipment', 'languages', 'locations', 'magic' diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 3fc79029..3b5cc664 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -9,6 +9,5 @@ * compiled file, but it's generally better to create a new file per style scope. * *= require_self - *= require bootplus_overrides *= require_tree . */ diff --git a/app/assets/stylesheets/bootplus_overrides.css.less b/app/assets/stylesheets/bootplus_overrides.css.less deleted file mode 100644 index fb9f3fff..00000000 --- a/app/assets/stylesheets/bootplus_overrides.css.less +++ /dev/null @@ -1,9 +0,0 @@ -@import 'bootplus/bootplus'; -@import 'bootplus/responsive'; -@import 'font-awesome/font-awesome'; - -// Set the correct sprite paths -@iconSpritePath: "glyphicons-halflings.png"; -@iconWhiteSpritePath: "glyphicons-halflings-white.png"; - -body { margin-top: 60px; } \ No newline at end of file diff --git a/app/assets/stylesheets/cards.css.scss b/app/assets/stylesheets/cards.css.scss new file mode 100644 index 00000000..fcdf8f4b --- /dev/null +++ b/app/assets/stylesheets/cards.css.scss @@ -0,0 +1,53 @@ +.card { + margin: 10px 0; + padding-top: 15px; + border: 1px solid #d8d8d8; + border-bottom-width: 2px; + border-top-width: 0; + background-color: #ffffff; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -box-sizing: border-box; + + .card-heading { + text-transform: capitalize; + border-bottom: 1px solid #e5e5e5; + color: #777; + font-size: 20px; + font-weight: 300; + margin: 0 -15px; + padding: 0px 35px 10px 35px; + } + + .card-image { + + } + + .card-body { + padding: 10px 20px; + font-family: Roboto, arial, sans-serif; + font-size: 13px; + line-height: 20px; + color: #444444; + + h2 { + font-size: 29px; + small { + font-size: 16px; + } + } + } + + .card-comments { + padding: 20px; + margin: 0; + background-color: #f8f8f8; + } + +} diff --git a/app/assets/stylesheets/characters.css.scss b/app/assets/stylesheets/characters.css.scss deleted file mode 100644 index 003272d6..00000000 --- a/app/assets/stylesheets/characters.css.scss +++ /dev/null @@ -1,6 +0,0 @@ -// Place all the styles related to the Characters controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ -.form-actions { - clear: both; -} diff --git a/app/assets/stylesheets/equipment.css.scss b/app/assets/stylesheets/equipment.css.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/app/assets/stylesheets/forms.css.scss b/app/assets/stylesheets/forms.css.scss new file mode 100644 index 00000000..af6fb1e6 --- /dev/null +++ b/app/assets/stylesheets/forms.css.scss @@ -0,0 +1,21 @@ +form { + .text_field { + padding: 0 8px; + border-top: 1px solid #c0c0c0; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + min-height: 29px; + background-color: #ffffff; + border: 1px solid #d9d9d9; + -webkit-transition: border linear .2s, box-shadow linear .2s; + -moz-transition: border linear .2s, box-shadow linear .2s; + -o-transition: border linear .2s, box-shadow linear .2s; + transition: border linear .2s, box-shadow linear .2s; + } +} + +#placeholder_map_input { + width: 100%; + display: block; +} \ No newline at end of file diff --git a/app/assets/stylesheets/generator.css.scss b/app/assets/stylesheets/generator.css.scss deleted file mode 100644 index 3c77911e..00000000 --- a/app/assets/stylesheets/generator.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the Generator controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/landing.css.scss b/app/assets/stylesheets/landing.css.scss new file mode 100644 index 00000000..850cadf7 --- /dev/null +++ b/app/assets/stylesheets/landing.css.scss @@ -0,0 +1,12 @@ +#landing-page-1 { + + #content-types { + .card { + img { + height: 200px; + width: 100%; + } + min-height: 400px; + } + } +} diff --git a/app/assets/stylesheets/language.css.scss b/app/assets/stylesheets/language.css.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/app/assets/stylesheets/locations.css.scss b/app/assets/stylesheets/locations.css.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/app/assets/stylesheets/magic.css.scss b/app/assets/stylesheets/magic.css.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/app/assets/stylesheets/main.css.scss b/app/assets/stylesheets/main.css.scss deleted file mode 100644 index 8cb83229..00000000 --- a/app/assets/stylesheets/main.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the main controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ \ No newline at end of file diff --git a/app/assets/stylesheets/navbar.css.scss b/app/assets/stylesheets/navbar.css.scss new file mode 100644 index 00000000..d7740ac4 --- /dev/null +++ b/app/assets/stylesheets/navbar.css.scss @@ -0,0 +1,21 @@ +.navbar-fixed-top { + border-bottom: 1px solid #d8d8d8 !important; + background-color: #ffffff; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -box-sizing: border-box; + + & a { + color: #777777; + &:hover { + color: #000000; + } + } +} + diff --git a/app/assets/stylesheets/sessions.css.scss b/app/assets/stylesheets/sessions.css.scss deleted file mode 100644 index ccb1ed25..00000000 --- a/app/assets/stylesheets/sessions.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the Sessions controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/structure.css.scss b/app/assets/stylesheets/structure.css.scss new file mode 100644 index 00000000..5bf25761 --- /dev/null +++ b/app/assets/stylesheets/structure.css.scss @@ -0,0 +1,7 @@ +.footer { + margin-top: 120px; + + & p { + text-align: center; + } +} diff --git a/app/assets/stylesheets/tabs.css.scss b/app/assets/stylesheets/tabs.css.scss new file mode 100644 index 00000000..b7ff677b --- /dev/null +++ b/app/assets/stylesheets/tabs.css.scss @@ -0,0 +1,5 @@ +.nav-stacked { + .active { + border-left: 3px solid #777; + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/theme.css.scss b/app/assets/stylesheets/theme.css.scss new file mode 100644 index 00000000..a67b2074 --- /dev/null +++ b/app/assets/stylesheets/theme.css.scss @@ -0,0 +1,8 @@ +body { + margin-top: 60px !important; + background: #e5e5e5 !important; +} + +.section { + margin: 30px 0; +} \ No newline at end of file diff --git a/app/assets/stylesheets/universes.css.scss b/app/assets/stylesheets/universes.css.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss deleted file mode 100644 index 1efc835c..00000000 --- a/app/assets/stylesheets/users.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the users controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 386ca8e1..5536a6af 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,14 +1,11 @@ class ApplicationController < ActionController::Base protect_from_forgery + + helper :html + helper :my_content helper_method :nl2br - helper_method :character_picker - helper_method :equipment_picker - helper_method :language_picker - helper_method :location_picker - helper_method :universe_picker - helper_method :universe_filter # View Helpers @@ -17,101 +14,6 @@ class ApplicationController < ActionController::Base string.gsub("\n\r","
").gsub("\r", "").gsub("\n", "
").html_safe end - def character_picker - characters = Character.where(user_id: session[:user]) - return if characters.length == 0 - - html = '' - html << '' - html << '' - html << '' - - return html.html_safe - end - - def equipment_picker - equipment = Equipment.where(user_id: session[:user]) - return if equipment.length == 0 - - html = '' - html << '' - html << '' - html << '' - - return html.html_safe - end - - def language_picker - languages = Language.where(user_id: session[:user]) - return if languages.length == 0 - - html = '' - html << '' - html << '' - html << '' - - return html.html_safe - end - - def location_picker - locations = Location.where(user_id: session[:user]) - return if locations.length == 0 - - html = '' - html << '' - html << '' - html << '' - - return html.html_safe - end - - def universe_picker - universes = Universe.where(user_id: session[:user]) - return if universes.length == 0 - - html = '' - html << '' - html << '' - html << '' - - return html.html_safe - end - def universe_filter universes = Universe.where(user_id: session[:user]) return if universes.length == 0 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2d2aec33..789d7968 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,7 +33,7 @@ module ApplicationHelper end end - def print_property(title, value, type) + def print_property(title, value, type = "") return unless value and value.length > 0 return [ diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb new file mode 100644 index 00000000..2351778d --- /dev/null +++ b/app/helpers/form_helper.rb @@ -0,0 +1,32 @@ +module FormHelper + def generate_form_row_for(form_handler, field, label_override = nil, toolbox = {}) + label = (label_override.nil? ? field : label_override.titleize) + [ + '
', + '
', + form_handler.label(label, :class => 'control-label'), + '
', + '
', + form_handler.text_field(field, :class => 'form-control'), + '
', + '
', + toolbox.map { |config| toolbox_button_for(config) }, + '
', + '
' + ].join("\n").html_safe + end + + def toolbox_button_for(config = {}) + if config[:action].ends_with? '_picker' + picker_type = config[:action].split('_picker').first + picker_from_type picker_type + else + [ + "" + ].join("\n").html_safe + end + end + +end diff --git a/app/helpers/html_helper.rb b/app/helpers/html_helper.rb new file mode 100644 index 00000000..feb06e80 --- /dev/null +++ b/app/helpers/html_helper.rb @@ -0,0 +1,54 @@ +module HtmlHelper + def picker_from_type(content_type) + case content_type + when 'character' + character_picker + when 'universe' + universe_picker + when 'equipment' + equipment_picker + when 'language' + language_picker + when 'location' + location_picker + end + end + + def generate_picker_code_for(content_array, glyphicon_id) + return if content_array.length == 0 + [ + '', + '', + '', + '' + ].join("\n").html_safe + end + + def character_picker + generate_picker_code_for(my_characters, 'user') + end + + def universe_picker + generate_picker_code_for(my_universes, 'globe') + end + + def equipment_picker + generate_picker_code_for(my_equipment, 'gift') + end + + def language_picker + generate_picker_code_for(my_languages, 'comment') + end + + def location_picker + generate_picker_code_for(my_locations, 'road') + end + +end diff --git a/app/helpers/my_content_helper.rb b/app/helpers/my_content_helper.rb new file mode 100644 index 00000000..ce5c73c3 --- /dev/null +++ b/app/helpers/my_content_helper.rb @@ -0,0 +1,21 @@ +module MyContentHelper + def my_characters + return Character.where(user_id: session[:user]) + end + + def my_universes + return Universe.where(user_id: session[:user]) + end + + def my_equipment + return Equipment.where(user_id: session[:user]) + end + + def my_languages + return Language.where(user_id: session[:user]) + end + + def my_locations + return Location.where(user_id: session[:user]) + end +end diff --git a/app/models/universe.rb b/app/models/universe.rb index d206cfff..7c914e20 100644 --- a/app/models/universe.rb +++ b/app/models/universe.rb @@ -47,4 +47,9 @@ class Universe Magic.where(universe_id: id) end + + def to_s + self.name + end + end diff --git a/app/views/characters/_edit_form.html.erb b/app/views/characters/_edit_form.html.erb deleted file mode 100644 index 9bc5ff13..00000000 --- a/app/views/characters/_edit_form.html.erb +++ /dev/null @@ -1,281 +0,0 @@ -<%= form_for @character, :url => character_edit_process_path, :html => { :class => 'form-horizontal' } do |f| %> - - - - - - - - - - - - - - - - - -
- <%= f.submit nil, :class => 'btn btn-primary' %> - <%= link_to t('.cancel', :default => t("helpers.links.cancel")), - character_list_path, :class => 'btn' %> -
-<% end %> diff --git a/app/views/characters/_form.html.erb b/app/views/characters/_form.html.erb index bdb6b4b0..8aeac484 100644 --- a/app/views/characters/_form.html.erb +++ b/app/views/characters/_form.html.erb @@ -1,260 +1,58 @@ -<%= form_for @character, :url => character_create_process_path, :html => { :class => 'form-horizontal' } do |f| %> - - -
- <%= f.submit nil, :class => 'btn btn-primary' %> - <%= link_to t('.cancel', :default => t("helpers.links.cancel")), - character_list_path, :class => 'btn' %> -
-<% end %> + \ No newline at end of file diff --git a/app/views/characters/_list.html.erb b/app/views/characters/_list.html.erb index 1139dc08..e859adca 100644 --- a/app/views/characters/_list.html.erb +++ b/app/views/characters/_list.html.erb @@ -1,35 +1,31 @@ - - - - - - - <% if session[:user] %> - - <% end %> - - - - <% @characters.each do |character| %> - - - - - - - <% end %> - -
NameRoleUniverse<%=t '.actions', :default => t("helpers.actions") %>
<%= simple_format link_to character.name, character_path(character) %><%= simple_format character.role %><%= character.universe ? character.universe.name : "" %> +<% @characters.each do |character| %> +
+
+

+ <%= simple_format link_to character.name, character_path(character) %> +

+
+

+ + <% if character.role.length > 0 %> + <%= character.role %><% if character.age.length > 0 %>, <%= character.age %><% end %> + <% end %> + +

+

+

+
+
+

<% if session[:user] and session[:user] == character.user.id %> <%= link_to t('.view', :default => t("helpers.links.view")), character_path(character), :class => 'btn' %> <%= link_to t('.edit', :default => t("helpers.links.edit")), character_edit_path(character), :class => 'btn' %> - <%= link_to t('.destroy', :default => t("helpers.links.destroy")), - character_path(character), - :method => :delete, - :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), - :class => 'btn btn-danger' %> <% end %> -

- + +

+ + + +<% end %> diff --git a/app/views/characters/_tabs.html.erb b/app/views/characters/_tabs.html.erb index 5f81f836..8d442efb 100644 --- a/app/views/characters/_tabs.html.erb +++ b/app/views/characters/_tabs.html.erb @@ -1,10 +1,14 @@ -