diff --git a/app/assets/fonts/ahg.eot b/app/assets/fonts/ahg.eot new file mode 100644 index 0000000..9be536f Binary files /dev/null and b/app/assets/fonts/ahg.eot differ diff --git a/app/assets/fonts/ahg.svg b/app/assets/fonts/ahg.svg new file mode 100644 index 0000000..51213a8 --- /dev/null +++ b/app/assets/fonts/ahg.svg @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/assets/fonts/ahg.ttf b/app/assets/fonts/ahg.ttf new file mode 100644 index 0000000..7986476 Binary files /dev/null and b/app/assets/fonts/ahg.ttf differ diff --git a/app/assets/fonts/ahg.woff b/app/assets/fonts/ahg.woff new file mode 100644 index 0000000..98af99d Binary files /dev/null and b/app/assets/fonts/ahg.woff differ diff --git a/app/assets/fonts/stylesheet.css b/app/assets/fonts/stylesheet.css new file mode 100644 index 0000000..d798597 --- /dev/null +++ b/app/assets/fonts/stylesheet.css @@ -0,0 +1,15 @@ +/* Generated by Font Squirrel (http://www.fontsquirrel.com) on June 29, 2014 */ + + + +@font-face { + font-family: 'Alte Haas Grotesk'; + src: url('altehaasgroteskbold-webfont.eot'); + src: url('altehaasgroteskbold-webfont.eot?#iefix') format('embedded-opentype'), + url('altehaasgroteskbold-webfont.woff') format('woff'), + url('altehaasgroteskbold-webfont.ttf') format('truetype'), + url('altehaasgroteskbold-webfont.svg#alte_haas_groteskbold') format('svg'); + font-weight: normal; + font-style: normal; + +} \ No newline at end of file diff --git a/app/assets/images/Thumbs.db b/app/assets/images/Thumbs.db index a7df432..a26d43f 100644 Binary files a/app/assets/images/Thumbs.db and b/app/assets/images/Thumbs.db differ diff --git a/app/assets/images/logo-text.png b/app/assets/images/logo-text.png new file mode 100644 index 0000000..e35555c Binary files /dev/null and b/app/assets/images/logo-text.png differ diff --git a/app/assets/images/logo.png b/app/assets/images/logo.png new file mode 100644 index 0000000..25f4f38 Binary files /dev/null and b/app/assets/images/logo.png differ diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index aaa3a37..3ecc9f6 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -163,7 +163,13 @@ startTranslating = ($td) -> return $ -> - $(document).foundation(); + trial = document.createElement('script'); + trial.type = 'text/javascript'; + trial.async = true; + trial.src = 'http://easy.myfonts.net/v2/js?sid=158991(font-family=Scotch+Modern+Bold)&sid=174040(font-family=Scotch+Micro)&key=WPfecRji9L'; + head = document.getElementsByTagName("head")[0]; + head.appendChild(trial); + #$(document).foundation(); $('.field.country-select select').change () -> $country = $(this) country = $country.val() diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 6949aff..a521475 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -10,16 +10,25 @@ * */ - -// Fonts and other external imports -@import url(http://fonts.googleapis.com/css?family=Fjalla+One); -@import url(http://fonts.googleapis.com/css?family=Cantarell:400,700,400italic,700italic); +@font-face { + font-family: 'alte_haas_groteskbold'; + src: url('/assets/ahg.eot'); + src: url('/assets/ahg.eot?#iefix') format('embedded-opentype'), + url('/assets/ahg.woff') format('woff'), + url('/assets/ahg.ttf') format('truetype'), + url('/assets/ahg.svg#alte_haas_groteskbold') format('svg'); + font-weight: normal; + font-style: normal; +} // Libraries @import "compass"; @import "foundation_and_overrides"; // Local settings (also edit foundation_and_overrides.scss to modify global variables) +@import "sass/mixins"; @import "sass/layout"; @import "sass/typography"; @import "sass/base"; + +#mfPreviewBarShow, #mfPreviewBar { display: none; } \ No newline at end of file diff --git a/app/assets/stylesheets/foundation_and_overrides.scss b/app/assets/stylesheets/foundation_and_overrides.scss index 641ec4e..db1b3c7 100644 --- a/app/assets/stylesheets/foundation_and_overrides.scss +++ b/app/assets/stylesheets/foundation_and_overrides.scss @@ -37,8 +37,8 @@ // We use these to control header font styles //$header-font-family: 'ff-ernestine-web-pro', sans-serif;//join("Open Sans", $body-font-family); -$header-font-family: 'freight-sans-pro', sans-serif;//join("Open Sans", $body-font-family); -$header-font-weight: 800; +$header-font-family: 'Alte Haas Grotesk', sans-serif;//join("Open Sans", $body-font-family); +$header-font-weight: bold; // $header-font-style: normal; // $header-font-color: #222; // $header-line-height: 1.4; @@ -46,23 +46,25 @@ $header-font-weight: 800; // $header-bottom-margin: .5rem; // $header-text-rendering: optimizeLegibility; -$color-1: #053E8D; // blue -$color-2: #94A427; // green -$color-4: #F4921B; // dark-orange -$color-3: #F4A71C; // light orange -$color-5: #DC3637; // red +$color-1: #00ACEE; // blue +$color-2: #A0C700; // green +$color-3: #F11845; // pink +$color-4: #FFCC00; // yellow +$color-5: #D3BE9B; // beige -$organization-color: $color-2; // red +$conference-color: $color-1; +$organization-color: $color-2; +$article-color: $color-3; //$white: #EEEEE0; -$white: #FFFFF0; -$black: #333; +$white: #FFF; +$black: #393939; $gray: #E1E1E1; // We use these to control various global styles -$body-bg: $black; +$body-bg: $white; $body-font-color: $black; -$body-font-family: 'freight-micro-pro', Helvetica, Arial, sans-serif; +$body-font-family: 'Scotch Micro', serif; // $body-font-weight: normal; // $body-font-style: normal; @@ -78,8 +80,8 @@ $primary-color: $color-1; $secondary-color: $color-2; $alert-color: $color-4; $success-color: $color-2; -$warning-color: $color-5; -$info-color: $color-3; +$warning-color: $color-3; +$info-color: $color-5; // We use these to make sure border radius matches unless we want it different. // $global-radius: 3px; @@ -227,8 +229,8 @@ $align-block-grid-to-grid: true; // We use these to build padding for buttons. // $button-tny: rem-calc(10); $button-sml: 0.25rem; -// $button-med: rem-calc(16); -// $button-lrg: rem-calc(18); +$button-med: 1.3333rem; +$button-lrg: 2rem; // We use this to control the display property. // $button-display: inline-block; @@ -236,24 +238,25 @@ $button-sml: 0.25rem; // We use these to control button text styles. $button-font-family: $header-font-family; -$button-font-color: $primary-color; +$button-font-color: $white; $button-font-color-alt: $secondary-color; // $button-font-tny: rem-calc(11); // $button-font-sml: rem-calc(13); // $button-font-med: rem-calc(16); // $button-font-lrg: rem-calc(20); -// $button-font-weight: normal; -// $button-font-align: center; +$button-font-weight: bold; +$button-font-align: center; // We use these to control various hover effects. // $button-function-factor: 5%; // We use these to control button border styles. -$button-border-width: 1px; +$button-border-width: 0.15em; $button-border-style: solid; +$button-border-color: transparent; // We use this to set the default radius used throughout the core. -$button-radius: 1.5em; +$button-radius: 0; // $button-round: $global-rounded; // We use this to set default opacity for disabled buttons. diff --git a/app/assets/stylesheets/sass/_layout.scss b/app/assets/stylesheets/sass/_layout.scss index 3355ebc..78ca53a 100644 --- a/app/assets/stylesheets/sass/_layout.scss +++ b/app/assets/stylesheets/sass/_layout.scss @@ -4,11 +4,194 @@ */ -html, #footer .container { - background-color: $primary-color +html { + background-color: $white } body { + background-color: $primary-color; +} + +#main-nav { + background-color: $white; + width: 100%; + display: table; + font-size: 0.6667em; + font-size: 2.4vw; + + p { + display: none; + } + + .button { + width: 29%; + margin: 0; + + &.logo { + background-color: $white; + width: 13%; + border: 0; + padding: 0; + vertical-align: top; + + .logo { + width: auto; + height: 2.4em; + } + + .logo-text { + display: none; + } + + &:hover { + background-color: transparent; + color: $black; + } + } + } + + @include breakpoint(medium) { + display: block; + min-height: 100%; + float: left; + width: 25%; + padding: 2.5%; + font-size: 1em; + + .button, p { + display: block; + } + + p { + font-size: 0.9em; + } + + .button { + width: auto; + margin: 0 0 1.25rem; + + &.logo { + width: 100%; + margin-bottom: 2em; + + .logo { + float: left; + width: 40%; + height: auto; + margin-right: 10%; + } + + .logo-text { + display: block; + width: 50%; + } + } + } + } +} + +main { + min-height: 100%; + //overflow: auto; + background-color: $primary-color; +} + +#banner { + position: relative; + padding-bottom: 4em; + background-size: cover; + background-position: center 66.6667%; + color: $white; + background-color: rgba($conference-color, 0.33); + background-blend-mode: overlay; + overflow: hidden; + @include text-shadow(0 0 0.5em $black); + + h1, h2 { + color: inherit; + } + + .no-blend-modes & { + &:before { + content: ''; + display: block; + position: absolute; + background-color: inherit; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1; + } + } + + &:after { + content: ''; + display: block; + position: absolute; + //background-color: inherit; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1; + @include background-image(linear-gradient(top, rgba(0,0,0,0) 50%, darken($primary-color, 25) 100%)); + mix-blend-mode: multiply; + } + + .row { + height: 50%; + z-index: 2; + position: relative; + } + + .button { + width: 75%; + color: inherit; + border-color: inherit; + background-color: rgba(darken($article-color, 0), 0.33); + padding: 0.75em 1em; + @include text-shadow(none); + + &:hover { + background-color: $article-color; + color: $white; + border-color: transparent; + } + } + + @include breakpoint(medium) { + min-height: 40em; + height: 100%; + height: 100vh; + } +} + +.align-bottom { + display: -webkit-flexbox; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + -webkit-flex-align: flex-end; + -ms-flex-align: flex-end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.centered { + text-align: center; +} + +#footnotes_debug { + display: none; +} + +#footer { + min-height: 5em; + background-color: inherit; +} + +/*body { height: auto; } @@ -27,18 +210,6 @@ main { .no-banner & { //border-top: 0.25em solid $primary-color; } - - /*.no-banner &:before { - content: '///////////////'; - color: #CCC; - font-weight: 100; - font-family: $header-font-family; - letter-spacing: 0.33333em; - font-size: 1em; - text-align: center; - display: block; - font-style: italic; - }*/ } $body-background-color: $white; @@ -397,7 +568,4 @@ table { } } -/*[class*="block-grid-"] { - margin: 0; -} */ diff --git a/app/assets/stylesheets/sass/_mixins.scss b/app/assets/stylesheets/sass/_mixins.scss new file mode 100644 index 0000000..a5f3830 --- /dev/null +++ b/app/assets/stylesheets/sass/_mixins.scss @@ -0,0 +1,11 @@ +@mixin breakpoint($query) { + @if $query == small { + @media #{$small-only} { @content; } + } @else if $query == medium { + @media #{$medium-up} { @content; } + } @else if $query == large { + @media #{$large-up} { @content; } + } @else { + @media #{$query} { @content; } + } +} diff --git a/app/assets/stylesheets/sass/_typography.scss b/app/assets/stylesheets/sass/_typography.scss index 9543de2..b0001dd 100644 --- a/app/assets/stylesheets/sass/_typography.scss +++ b/app/assets/stylesheets/sass/_typography.scss @@ -4,46 +4,11 @@ */ -$translate-me-bgcolor: rgba(255, 0, 0, 0.25) !default; -$translate-me-outline-color: rgba(255, 0, 0, 0.5) !default; - -.translate-me { - cursor: url(translate_cursor-32.png) 8 31, auto; - - &.untranslated { - background-color: $translate-me-bgcolor; - @include opacity(0.5); - } - - &:hover, - &.selected { - @include opacity(1); - outline: 2px solid $translate-me-outline-color; - outline-offset: 0; - outline-style: dashed; - } - &.preview { - background-color: inherit; - outline-style: solid; - -webkit-animation: preview-translation 2s infinite; - } -} - -@-webkit-keyframes preview-translation { - 0% { - outline-color: rgba(0, 255, 0, 1); - } - 50% { - outline-color: rgba(0, 255, 0, 0); - } - 100% { - outline-color: rgba(0, 255, 0, 1); - } -} +//$translate-me-bgcolor: rgba(255, 0, 0, 0.25) !default; +//$translate-me-outline-color: rgba(255, 0, 0, 0.5) !default; .button, button, input[type="file"] { - background-color: rgba($white, 0.5); - border-radius: 1.5em; + /*background-color: rgba($white, 0.5); color: $primary-color; border: 1px solid; padding: 0.75em 1.5em; @@ -52,6 +17,36 @@ $translate-me-outline-color: rgba(255, 0, 0, 0.5) !default; &:hover { color: #FFF; + }*/ + + background-color: $primary-color; + color: $white; + font-weight: bold; + //font-family: $header-font-family; + font-size: 1.333em; + border: 0.15em solid transparent; + padding: 0.5em 1em; + + &.organization, &.secondary { + background-color: $organization-color; + } + + &.article { + background-color: $article-color; + } + + &:hover { + color: $primary-color; + border: 0.15em solid; + background-color: transparent; + + &.organization { + color: $organization-color; + } + + &.article { + color: $article-color; + } } } diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4c6e18d..39afadb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,8 @@ +module ActiveRecord + class PremissionDenied < RuntimeError + end +end + class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. @@ -8,4 +13,12 @@ class ApplicationController < ActionController::Base def capture_page_info $page_info = {:path => request.env['PATH_INFO'], :controller => params['controller'], :action => params['action']} end + + rescue_from ActiveRecord::RecordNotFound do |exception| + render 'pages/404', status: 404 + end + + rescue_from ActiveRecord::PremissionDenied do |exception| + render 'permission_denied', status: 404 + end end diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 0cc7788..893c3e6 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -11,6 +11,7 @@ class ConferencesController < ApplicationController # GET /conferences/1 def show + #puts params[:slug] end # GET /conferences/new @@ -21,6 +22,9 @@ class ConferencesController < ApplicationController # GET /conferences/1/edit def edit + if !current_user + raise ActiveRecord::PremissionDenied + end @host = @conference.organizations[0].locations[0] #points = Geocoder::Calculations.bounding_box([@host.latitude, @host.longitude], 50, { :unit => :km }) result = Geocoder.search(@host.city + ', ' + @host.territory + ' ' + @host.country).first @@ -100,6 +104,23 @@ class ConferencesController < ApplicationController end end + def register + set_conference + @user = User.new + @sub_action = 'registration_register' + render :registration + end + + def register_step + set_conference + data = params + if params[:conference][:user][:email] + user = User.find_by(:email => params[:conference][:user][:email]) + data[:conference][:user][:username] = user.username + end + render json: data + end + def add_field set_conference field = RegistrationFormField.find(params[:field]) @@ -151,8 +172,18 @@ class ConferencesController < ApplicationController private # Use callbacks to share common setup or constraints between actions. def set_conference - @conference = Conference.find_by(slug: params[:conference_slug] || params[:slug]) - set_conference_registration + @conference = nil + if type = ConferenceType.find_by!(slug: params[:conference_type_slug] || 'bikebike') + if @conference = Conference.find_by!(slug: params[:conference_slug] || params[:slug], conference_type_id: type.id) + set_conference_registration + end + end + if current_user + @host_privledge = :admin + end + #if !@conference + # raise ActionController::RoutingError.new('Not Found') + #end end def set_conference_registration diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index e448139..bf438b3 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -101,12 +101,12 @@ class OrganizationsController < ApplicationController end territory = countries[location.country.downcase][:territories][location.territory.downcase] if !orgs[location.country.downcase][location.territory.downcase].has_key?(location.territory.downcase) - orgs[location.country.downcase][location.territory.downcase][location.territory.downcase] = Hash.new - orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][:latitude] = location.latitude - orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][:longitude] = location.longitude - orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][:count] = 0 + orgs[location.country.downcase][location.territory.downcase][location.city.downcase] = Hash.new + orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:latitude] = location.latitude + orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:longitude] = location.longitude + orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:count] = 0 end - orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][orgs[location.country.downcase][location.territory.downcase][location.territory.downcase]['count']] = { + orgs[location.country.downcase][location.territory.downcase][location.city.downcase][orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:count]] = { :title => org.name, :id => org.id, :logo => org.avatar.url(:thumb), @@ -126,7 +126,7 @@ class OrganizationsController < ApplicationController :url => url_for(org), :order => order } - orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][:count] += 1 + orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:count] += 1 order += 1 } render :json => orgs.to_json @@ -135,7 +135,9 @@ class OrganizationsController < ApplicationController private # Use callbacks to share common setup or constraints between actions. def set_organization - @organization = Organization.find_by(slug: params[:slug] || params[:organization_slug]) + if params[:slug] != 'json' + @organization = Organization.find_by!(slug: params[:slug] || params[:organization_slug]) + end end # Only allow a trusted parameter "white list" through. diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 60c9c78..bf7d391 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -3,6 +3,7 @@ include ApplicationHelper class PagesController < ApplicationController def home + @conference = Conference.find(:first, :order => "start_date DESC") end def translate diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5e8b1da..8887a46 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,6 +4,8 @@ module ApplicationHelper @@lastTranslation = nil @@allTranslations = nil @@no_banner = true + @@banner_attribution_details = nil + @@banner_image = nil def ThereAreTranslationsOnThisPage? @@translationsOnThisPage @@ -17,13 +19,17 @@ module ApplicationHelper content_for(:title) { page_title.to_s } end - def banner_image(banner_image) + def banner_image(banner_image, name: nil, id: nil, user_id: nil, src: nil) @@no_banner = false + if (name || id || user_id || src) + @@banner_attribution_details = {:name => name, :id => id, :user_id => user_id, :src => src} + end content_for(:banner_image) { banner_image.to_s } end def banner_attrs(banner_image) if banner_image.length > 0 + @@banner_image = banner_image return {style: 'background-image: url(' + banner_image + ');', class: 'has-image' } end {class: 'no-image'} @@ -38,6 +44,25 @@ module ApplicationHelper content_for(:banner) { ('

' + banner_title.to_s + '

').html_safe } end + def banner_attribution + if @@banner_image && @@banner_attribution_details + src = @@banner_attribution_details[:src] + attribution = '
' + if src == 'panoramio' + attribution += '' + + _('Image_provided_by_panoramio_user') + + ' ' + @@banner_attribution_details[:name] + '' + + '' + _('Photos_provided_by_Panoramio_are_under_the_copyright_of_their_owners') + '' + end + attribution += '
' + attribution.html_safe + end + end + + def dom_ready(&block) + content_for(:dom_ready, &block) + end + def page_style(style) classes = ['page-style-' + style.to_s] if @@no_banner @@ -148,19 +173,13 @@ module ApplicationHelper def _do_translate(key, vars, behavior, behavior_size, locale) translation = {'key' => key, 'lang' => '0', 'vars' => vars} v = vars.dup - #locale ||= I18n.locale begin v[:raise] = true - #v[:locale] = locale.to_sym - #v[:fallback] = false - #puts "\nSTART\n" options = {:raise => true} if locale options[:locale] = locale.to_sym end - #puts "\n#{options.to_json.to_s}\n" translation['untranslated'] = I18n.translate(key, v, options) - #puts "\nEND\n" translation['lang'] = locale.to_s translation['is_translated'] = true @@ -168,16 +187,9 @@ module ApplicationHelper translations = Translation.where(["locale = ? AND key LIKE ?", locale.to_s, key + '%']).take(6).each { |o| hash[o.key] = o.value } translation['translated'] = hash.to_json.gsub('"', '"') rescue I18n::MissingTranslationData - #begin - #translation['untranslated'] = I18n.translate!(config.i18n.default_locale, key, vars) - #translation['lang'] = config.i18n.default_locale.to_s - #rescue - #puts "BEHAVIOR:\t#{behavior.to_s}" default_translation = I18n::MissingTranslationExceptionHandler.note(key, behavior, behavior_size) translation['untranslated'] = default_translation - #end end - puts "TRANSLATION:\t#{translation.to_json.to_s}" return translation end @@ -238,7 +250,7 @@ module ApplicationHelper link_html = link_to func.to_s.gsub(/_path$/, ''), args ? self.send(func, args) : self.send(func), :class => c else #x - link_html = link_to tab, link || object, :class => c + #link_html = link_to tab, link || object, :class => c end tab_list += link_html end diff --git a/app/helpers/bike_bike_form_helper.rb b/app/helpers/bike_bike_form_helper.rb index 3181b8b..1091921 100644 --- a/app/helpers/bike_bike_form_helper.rb +++ b/app/helpers/bike_bike_form_helper.rb @@ -304,26 +304,28 @@ module BikeBikeFormHelper params[:value] = value template = template_exists?(type) ? type : 'default' - params[:label_template] = options[:label] === false ? nil : get_label_template(type) - params[:label_position] = options[:label] === false ? :none : label_position(type) + params[:label_template] = options[:label] === false ? nil : get_label_template(type, options) + params[:label_position] = options[:label] === false ? :none : label_position(type, options) render(template, params) end - def get_label_template(type) - if /select(_field)?$/.match(type.to_s) + def get_label_template(type, options) + if !options[:label] && /select(_field)?$/.match(type.to_s) return nil end template_exists?('label_' + type) ? type : 'default' end - def label_position(type) + def label_position(type, options) # one of: :before, :after, :inside, or :none case type when 'image_field' return :inside when 'organization_select_field' return :none + #when 'select_field' + # return :before end return :before end diff --git a/app/models/conference.rb b/app/models/conference.rb index 5d09ece..aa36b85 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -17,5 +17,18 @@ class Conference < ActiveRecord::Base def to_param slug end +# + #def self.find_by_param(slug) + # find_by_slug_and_conference_type(slug, ConferenceType.find_by_slug('regional').id) + #end + + def url(action = :show) + path(action) + end + + def path(action = :show) + action = action.to_sym + '/conferences/' + conference_type.slug + '/' + slug + (action == :show ? '' : '/' + action.to_s) + end end diff --git a/app/models/conference_type.rb b/app/models/conference_type.rb index 5eaf36d..f8cfca0 100644 --- a/app/models/conference_type.rb +++ b/app/models/conference_type.rb @@ -1,3 +1,7 @@ class ConferenceType < ActiveRecord::Base #belongs_to :conference + + def to_param + slug + end end diff --git a/app/views/conferences/_header.html.haml b/app/views/conferences/_header.html.haml new file mode 100644 index 0000000..7e1f455 --- /dev/null +++ b/app/views/conferences/_header.html.haml @@ -0,0 +1,25 @@ +- banner_image @conference.cover_url, id: 532693, name: 'phil', user_id: 1429589, src: 'panoramio' +- page_style 'emphasize-banner' + +- content_for :banner do + .row + .columns.small-12 + %figure + %img{src: @conference.poster_url} + .row.align-bottom + .columns.medium-6 + %h1='Bike!Bike! '+@conference.start_date.year.to_s + %h2 + - location = @conference.organizations.first.locations.first + = location.city + ', ' + (location.territory || location.country) + %em + = (l @conference.start_date, format: :date) + ' - ' + (l @conference.end_date, format: :date) + %p + = @conference.info + .columns.medium-6.centered + - if @conference.registration_open + %a.button{href: @conference.url(:register)} + =_'conference.Register_Now' + - if params['controller'] != 'conferences' + %a.button.more{href: @conference.url} + =_'conference.More_Info' \ No newline at end of file diff --git a/app/views/conferences/_registration_register.html.haml b/app/views/conferences/_registration_register.html.haml index 1cb0be6..3f60166 100644 --- a/app/views/conferences/_registration_register.html.haml +++ b/app/views/conferences/_registration_register.html.haml @@ -1,8 +1,45 @@ -.columns.medium-8 - = select_tag :is_attending, ConferenceRegistration::AttendingOptions, label: 'Are you attending?', value: @conference_registration.try(:is_attending) +.columns{:class => @host_privledges ? 'medium-8' : 'medium-12'} + = f.fields_for @user do |u| + .columns#step-1.registration-step= u.email_field :email + %button#submit-email.next=_'form.Next' + = f.fields_for @user do |u| + .columns#step-2.registration-step= u.text_field :username + -# .columns.medium-6 + = select_tag :is_attending, options_for_select(ConferenceRegistration::AttendingOptions, @conference_registration.try(:is_attending)), :label => true %ol - @conference.registration_form_fields.each do |ff| %li - response = @conference_registration ? ConferenceRegistrationResponse.find_by(conference_registration_id: @conference_registration.id, registration_form_field_id: ff.id) : nil = form_field ff, response -= form_actions :register += f.actions :register + +- content_for :scripts do + :plain + function updateForm(data, step) { + $('.registration-step').each(function() { + var $this = $(this); + var this_step = parseInt($this.attr('id').replace(/^step\-(\d+)$/, '$1')); + if (this_step > step) { + $this.find('input,select').each(function(){ + var $input = $(this); + var params = $input.attr('name').match(/\[(.*?)\]/g); + var val = data.conference; + for (key in params) { + var k = params[key].replace(/\[(.*)\]/, '$1'); + val = val[params[key].replace(/\[(.*)\]/, '$1')]; + } + $input.val(val) + }); + } + }); + } + +- dom_ready do + :plain + $('#submit-email').click(function(e){ + e.preventDefault(); + $.post('register/step/1', $('form.edit_conference').serialize(), function(data) { + //console.log(data.conference.user.username); + updateForm(data, 1); + }); + }); diff --git a/app/views/conferences/permission_denied.html.haml b/app/views/conferences/permission_denied.html.haml new file mode 100644 index 0000000..b4838c9 --- /dev/null +++ b/app/views/conferences/permission_denied.html.haml @@ -0,0 +1,8 @@ +- title 'Bike!Bike!' += render 'header' + +.row + %h1 + =_'error.title.Permission_Denied' + %p + =_'error.desc.permission_denied', :p \ No newline at end of file diff --git a/app/views/conferences/registration.html.haml b/app/views/conferences/registration.html.haml index 255ee02..5223fd5 100644 --- a/app/views/conferences/registration.html.haml +++ b/app/views/conferences/registration.html.haml @@ -1,11 +1,14 @@ += render 'header' + - page_style :form = tabs! .row = form_for @conference do |f| - .columns.medium-4 - =sub_tabs! - %h2=_'conference.hosts.help.title', :t - %p=_'conference.hosts.help', :p + - if @host_privledges + .columns.medium-4 + =sub_tabs! + %h2=_'conference.hosts.help.title', :t + %p=_'conference.hosts.help', :p = render @sub_action, :f => f = yield_or_default(:after_form) \ No newline at end of file diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 6afc8f8..ba6731b 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -1,23 +1,5 @@ - title 'Bike!Bike!' -- banner_image @conference.cover_url -- page_style 'emphasize-banner' - -- content_for :banner do - .row - .columns.medium-6 - %figure - %img{src: @conference.poster_url} - .columns.medium-6.info - %h1='Bike!Bike!' - %h2 - Columbus, Ohio - %em - = (l @conference.start_date, format: :date) + ' - ' + (l @conference.end_date, format: :date) - %p - = _ 'nola_2013.about', 'paragraph' - .centered - %a.button{href: '#'} - Register Now += render 'header' = tabs! @@ -71,6 +53,6 @@ %b Travel info: = @conference.travel_info - = link_to 'Edit', edit_conference_path(@conference) + = link_to 'Edit', @conference.path(:edit) #edit_conference_path(@conference.conference_type.slug, @conference) \| - = link_to 'Back', conferences_path + = link_to 'Back', 'conferences' diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index d09fadd..4bce85c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -30,6 +30,8 @@ = javascript_include_tag 'nested_form' %body{ class: (yield_or_default :page_style) } + :javascript + var b=document.getElementsByTagName('HTML')[0];b.className+=' '+(window.getComputedStyle(document.body).backgroundBlendMode?'':'no-')+'blend-modes'; = render 'shared/translation_control' = render 'shared/navbar' @@ -39,6 +41,7 @@ - if has_banner? %header#banner{banner_attrs(yield_or_default :banner_image)} = yield :banner + = banner_attribution = yield #footer .container= render 'shared/footer' diff --git a/app/views/layouts/fields/_default.html.haml b/app/views/layouts/fields/_default.html.haml index d702a7e..29590f7 100644 --- a/app/views/layouts/fields/_default.html.haml +++ b/app/views/layouts/fields/_default.html.haml @@ -7,4 +7,4 @@ = @label_position == :before && @label ? @label : '' - if @label_position != :inside %div=@html - = @label_position == :after && @label ? '' : @label + = @label_position == :after && @label ? @label : '' diff --git a/app/views/layouts/fields/_label_default.html.haml b/app/views/layouts/fields/_label_default.html.haml index 058ae84..6817a39 100644 --- a/app/views/layouts/fields/_label_default.html.haml +++ b/app/views/layouts/fields/_label_default.html.haml @@ -1,4 +1,4 @@ -- label = @options[:label] || _('form.label.' + @name.to_s) +- label = !@options[:label] || @options[:label] == true ? _('form.label.' + @name.to_s) : @options[:label] = label_tag @name do - if @label_position == :inside %div=@html diff --git a/app/views/pages/404.html.haml b/app/views/pages/404.html.haml new file mode 100644 index 0000000..a7b2f44 --- /dev/null +++ b/app/views/pages/404.html.haml @@ -0,0 +1 @@ +404!d \ No newline at end of file diff --git a/app/views/pages/home.html.haml b/app/views/pages/home.html.haml index 6e6a5b2..5302a1f 100644 --- a/app/views/pages/home.html.haml +++ b/app/views/pages/home.html.haml @@ -1,30 +1,11 @@ - title 'Bike!Bike!' -- banner_image '/assets/columbus.jpg' -- page_style 'emphasize-banner' += render 'conferences/header' -- content_for :banner do - .row - .columns.medium-6 - %figure - %img{src: '/assets/poster.jpg'} - .columns.medium-6.info - %h1 - Bike!Bike! 2014 - %h2 - Columbus, Ohio - %em - August 30 - September 1 - %p - = _ 'nola_2013.about', 'paragraph' - .centered - %a.button{href: '#'} - Register Now - -%section - .row - .columns.medium-6 - %h1 - Welcome to Bike!Bike! - %p - = _ 'home.its_awesome', 'paragraph' - .columns.medium-6 +-#%section +-# .row +-# .columns.medium-6 +-# %h1 +-# Welcome to Bike!Bike! +-# %p +-# = _ 'home.its_awesome', 'paragraph' +-# .columns.medium-6 diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml index 2fe7ad2..3aa5f47 100644 --- a/app/views/shared/_footer.html.haml +++ b/app/views/shared/_footer.html.haml @@ -1,5 +1,6 @@ %footer - %p - = link_to 'https://github.com/diowa/ruby2-rails4-bootstrap-heroku' do - %i.icon-github - diowa/ruby2-rails4-bootstrap-heroku +:javascript + #{yield :scripts} + $(function(){ + #{yield :dom_ready} + }); \ No newline at end of file diff --git a/app/views/shared/_navbar.html.haml b/app/views/shared/_navbar.html.haml index b8ac285..12695f9 100644 --- a/app/views/shared/_navbar.html.haml +++ b/app/views/shared/_navbar.html.haml @@ -1,37 +1,23 @@ - -%nav.top-bar.row{ data: { :topbar => '' } } - #nav-inner - %ul.title-area - / Title Area - %li.name - %h1 - %a{href: "/"} Bike!Bike! - / Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone - %li.toggle-topbar.menu-icon - %a{href: "#"} - %span Menu - %section.top-bar-section - / Left Nav Section - %ul.left - %li.active - = link_to (_'Conferences'), :controller => :conferences - %li - = link_to (_'Organizations'), :controller => :organizations - %li - = link_to (_'Resources'), '/resources' - / Right Nav Section - %ul.right - - if current_user - %li.has-form.sign-out.hide-for-small - = link_to (_"Sign_Out"), :logout, method: :post, :class => 'button' - %li.user-profile.has-dropdown - = link_to current_user do - = image_tag(current_user.avatar_url(:icon)) - %span - %span.show-for-small=current_user.username - %ul.dropdown - %li= link_to 'View Profile', current_user - %li= link_to 'Edit Profile', edit_user_path(current_user.id) - - else - %li.has-form.sign-in - = link_to (_"Sign_In"), :login, :class => 'button' +%nav#main-nav + = link_to '/resources', :class => ['button', 'logo'] do + = image_tag('logo.png', class: 'logo') + = image_tag('logo-text.png', class: 'logo-text') + = link_to (_'Conferences'), {:controller => :conferences}, {:class => ['button', 'conference']} + = link_to (_'Organizations'), {:controller => :organizations}, {:class => ['button', 'organization']} + = link_to (_'Zine'), 'http://zinezine.bikebike.org', :class => ['button', 'article'] + %p + Bike!Bike! is an international annual gathering organized by and for community bicycle projects. The conference is a space for participants from shops and related advocacy groups to converge in a different city each year over a 4 day period to have workshops and strengthen our social network. + -#- if current_user + -# %li.has-form.sign-out.hide-for-small + -# = link_to (_"Sign_Out"), :logout, method: :post, :class => 'button' + -# %li.user-profile.has-dropdown + -# = link_to current_user do + -# = image_tag(current_user.avatar_url(:icon)) + -# %span + -# %span.show-for-small=current_user.username + -# %ul.dropdown + -# %li= link_to 'View Profile', current_user + -# %li= link_to 'Edit Profile', edit_user_path(current_user.id) + -#- else + -# %li.has-form.sign-in + -# = link_to (_"Sign_In"), :login, :class => 'button' \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index e98b9ed..6415692 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,32 +1,34 @@ BikeBike::Application.routes.draw do - resources :events + #resources :events + #resources :event_types + #resources :workshop_requested_resources + #resources :workshop_facilitators + #resources :registration_form_fields - resources :event_types - - resources :workshop_requested_resources - - resources :workshop_facilitators - - resources :registration_form_fields - - resources :conferences, :param => 'slug' do - get :hosts - get :registration - resources :workshops, :param => 'slug' - get :registration - #resources :registrations, :path => 'registration' do - # get :form, on: :collection - #end - get 'registration/form' => 'conferences#registration', :sub_action => "form", as: 'registration_form' - get 'registration/form/register' => 'conferences#registration', :sub_action => "register", as: 'registration_register' - get 'registration/form/stats' => 'conferences#registration', :sub_action => "stats", as: 'registration_stats' - post :nonhosts - post 'registration/form/add-field' => 'conferences#add_field', as: 'registration_add_field' - post 'registration/form/remove-field' => 'conferences#remove_field', as: 'registration_remove_field' - post 'registration/form/reorder' => 'conferences#reorder', as: 'registration_reorder' + resources :conference_types, :param => :slug , :path => '/conferences', :as => :conference, :except => :index do + resources :conferences, :param => :slug, :path => '/' do + get :hosts + get :registration + resources :workshops, :param => 'slug' + get :registration + get :register + patch 'register/step/:step' => 'conferences#register_step' + #resources :registrations, :path => 'registration' do + # get :form, on: :collection + #end + get 'registration/form' => 'conferences#registration', :sub_action => "form", as: 'registration_form' + get 'registration/form/register' => 'conferences#registration', :sub_action => "register", as: 'registration_register' + get 'registration/form/stats' => 'conferences#registration', :sub_action => "stats", as: 'registration_stats' + post :nonhosts + post 'registration/form/add-field' => 'conferences#add_field', as: 'registration_add_field' + post 'registration/form/remove-field' => 'conferences#remove_field', as: 'registration_remove_field' + post 'registration/form/reorder' => 'conferences#reorder', as: 'registration_reorder' + end end + resources :conferences, :only => :index + resources :organizations, :param => 'slug' do get :members get :identity @@ -37,13 +39,12 @@ BikeBike::Application.routes.draw do resources :users resources :user_sessions - resources :conference_types - resources :workshop_streams - resources :workshop_resources - resources :workshop_presentation_styles + #resources :workshop_streams + #resources :workshop_resources + #resources :workshop_presentation_styles - resources :locations + #resources :locations post '/translate/' => 'pages#translate' post '/location/territories/' => 'pages#location_territories' diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake index a015722..89080cd 100644 --- a/lib/tasks/migrate.rake +++ b/lib/tasks/migrate.rake @@ -188,12 +188,14 @@ namespace :migrate do end def conference_post_save(json, object) - object.locations << location i = 0 + #puts "\nORGS:\t" + json[:field_host_organizations].to_json.to_s json[:field_host_organizations]['und'].each { |u| + #puts "\nORG:\t" + u.to_json object.conference_host_organizations << ConferenceHostOrganization.new(:organization_id => u['target_id'].to_i, :order => i) i += 1 } + #puts object.to_json.to_s object.save! end @@ -307,9 +309,9 @@ namespace :migrate do if params new_object = model.class.create(params) post_save = (type.singularize + '_post_save') - begin - self.send(post_save, object, new_object) - rescue; end + self.send(post_save, object, new_object) + #begin + #rescue; end end } else