diff --git a/Gemfile b/Gemfile index fca273b..99b4411 100644 --- a/Gemfile +++ b/Gemfile @@ -60,7 +60,7 @@ gem 'acts_as_list' gem 'geocoder' gem 'forgery' gem 'paper_trail' - +# gem 'panoramio-rb' # make it easier to let users get nice backdrops for their conferences etc group :development, :test do gem 'debugger' @@ -70,13 +70,13 @@ group :development, :test do end group :development do - gem 'bullet' - gem 'better_errors' - gem 'binding_of_caller' - gem 'meta_request' - gem 'haml-rails' - gem 'awesome_print' - gem 'rails-footnotes', :github => 'josevalim/rails-footnotes' + gem 'bullet' + gem 'better_errors' + gem 'binding_of_caller' + gem 'meta_request' + gem 'haml-rails' + gem 'awesome_print' + gem 'rails-footnotes', :github => 'josevalim/rails-footnotes' end group :test do diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index 655711f..7873559 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -59,7 +59,7 @@ selectA = (type, event, $emptyObj) -> $overlay = createOverlay() objs = [] $('.' + type + '-select-field.added input.' + type + '-id').each () -> obj.push($(this).val()) - $.post $emptyObj.data().url + (if type == 'organization' then '/nonhosts' else '/nonmembers'), {added: objs}, + $.post window.location.href.replace(/^(.*\/)(.+?)$/, '$1non$2'), {added: objs}, (html) -> setOverlayHTML(html).addClass('' + type + '-select') $('#select-' + type + '-list a').click (event) -> diff --git a/app/assets/stylesheets/foundation_and_overrides.scss b/app/assets/stylesheets/foundation_and_overrides.scss index b4137a4..641ec4e 100644 --- a/app/assets/stylesheets/foundation_and_overrides.scss +++ b/app/assets/stylesheets/foundation_and_overrides.scss @@ -182,7 +182,8 @@ $large: $large-up; // We use this to control the maximum number of block grid elements per row // $block-grid-elements: 12; -// $block-grid-default-spacing: rem-calc(20); +$block-grid-default-spacing: rem-calc(20); +$align-block-grid-to-grid: true; // Enables media queries for block-grid classes. Set to false if writing semantic HTML. // $block-grid-media-queries: true; diff --git a/app/assets/stylesheets/sass/_layout.scss b/app/assets/stylesheets/sass/_layout.scss index 08c2d1a..c4ee8e5 100644 --- a/app/assets/stylesheets/sass/_layout.scss +++ b/app/assets/stylesheets/sass/_layout.scss @@ -395,3 +395,8 @@ table { background: transparent !important; } } + +/*[class*="block-grid-"] { + margin: 0; +} +*/ diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 028daa3..0cc7788 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -1,3 +1,6 @@ +require 'geocoder/calculations' +require 'rest_client' + class ConferencesController < ApplicationController before_action :set_conference, only: [:show, :edit, :update, :destroy] @@ -18,6 +21,14 @@ class ConferencesController < ApplicationController # GET /conferences/1/edit def edit + @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 + points = Geocoder::Calculations.bounding_box([result.latitude, result.longitude], 5, { :unit => :km }) + response = RestClient.get 'http://www.panoramio.com/map/get_panoramas.php', :params => {:set => :public, :size => :original, :from => 0, :to => 20, :mapfilter => false, :miny => points[0], :minx => points[1], :maxy => points[2], :maxx => points[3]} + if response.code == 200 + @parse_data = JSON.parse(response.to_str) + end end # POST /conferences diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2bc6b64..5e8b1da 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -197,192 +197,6 @@ module ApplicationHelper end end - def field(form, name, type = nil, param = nil, html: nil, help: false, attrs: [], classes: nil, label: nil, placeholder: nil, value: nil, checked: nil, required: false) - - if form.is_a?(Symbol) || form.is_a?(String) - param = type - type = name - name = form - form = nil - end - - if attrs && !attrs.is_a?(Array) - attrs = [attrs] - end - - attrs_used = 0 - - root = 'div' - - lang_key = "form.#{name.to_s}" - if form - lang_key = form.object.class.name.underscore.pluralize + '.' + lang_key - elsif params[:controller] - lang_key = params[:controller] + '.' + lang_key - end - - select_prompt = nil - show_label = !(/^hidden_field/.match(type.to_s)) - label_after = true - value_attribute = !form - - if /select(_tag)?$/.match(type.to_s) - if !label - select_prompt = placeholder || (form ? 'Select a ' + (_ ('form.select_' + name.to_s)) : 'form.Select_one') - label_html = '' - show_label = false - end - placeholder = nil - label_after = false - if param - if param.is_a?(Array) - param = options_for_select(param, value) - elsif param.is_a?(Hash) - param = options_from_collection_for_select(param, :first, :last, value) - end - end - value_attribute = false - elsif type.to_s == 'image_field' || type.to_s == 'user_select_field' || type.to_s == 'organization_select_field' - placeholder = nil - label_html = '' - show_label = false - else - if /^password/.match(type.to_s) - placeholder = nil - elsif !placeholder - placeholder = (_ 'form.Enter_your_' + name.to_s) - end - end - - if show_label - label_html = eval("(" + (form ? 'form.label' : 'label_tag') + " name, '#{CGI.escapeHTML(_ (label || name.to_s))}'.html_safe)") - end - - if label === false || !show_label - label_html = '' - end - - if /text_area(_tag)?$/.match(type.to_s) - root = nil - end - - html_options = nil - if html - html_options = '' - html.each do |key, v| - html_options += ', ' + key.to_s + ": html[:" + key.to_s + "]" - end - end - - if classes - if classes.is_a?(String) - classes = [classes] - end - else - classes = [] - end - - if type == :image_field - form_html = form.label name do - ('
' + image_tag(param || 'http://placehold.it/300x300&text=Click%20to%20upload%20an%20Image') + (form.file_field name) + (form.hidden_field (name.to_s + '_cache')) + '
' + name.to_s + '').html_safe - end - elsif type == :user_select_field - form_html = form.hidden_field(:id, { class: 'id' }).html_safe - form_html += form.check_box(:_destroy).html_safe - form_html += form.label(:_destroy, '×').html_safe - form_html += form.hidden_field(:user_id, { class: 'user-id'} ).html_safe - if param && param.id - form_html += image_tag(param.avatar.url :thumb).html_safe + ('
' + param.username + '
').html_safe - if attrs && attrs.length > 0 && attrs[0].is_a?(UserOrganizationRelationship) - form_html += form.select(:relationship, options_for_select(UserOrganizationRelationship::AllRelationships, attrs[0].relationship), {}, {class: 'small'}).html_safe - attrs_used += 1 - end - else - classes << 'new' - if attrs && attrs.length > 0 && attrs[0].is_a?(UserOrganizationRelationship) - form_html += ('' + image_tag('http://placehold.it/120x120&text=%252B').html_safe + '
').html_safe - form_html += form.select(:relationship, options_for_select(UserOrganizationRelationship::AllRelationships, UserOrganizationRelationship::DefaultRelationship), {}, {class: 'small'}).html_safe - attrs_used += 1 - end - end - elsif type == :organization_select_field - form_html = form.hidden_field(:id, { class: 'id' }).html_safe - form_html += form.check_box(:_destroy).html_safe - form_html += form.label(:_destroy, '×').html_safe - form_html += form.hidden_field(:organization_id, { class: 'organzation-id'} ).html_safe - if param && param.id - form_html += image_tag(param.avatar.url :thumb).html_safe + ('
' + param.name + '
').html_safe - else - classes << 'new' - form_html += ('' + image_tag('http://placehold.it/120x120&text=%252B').html_safe + '
').html_safe - end - else - ph = '' - va = '' - if value_attribute - if /^(check_box|radio_button)/.match(type.to_s) - if checked === nil - checked = value == "on" || value.to_s == "1" - end - if /^(radio_button)/.match(type.to_s) - va = ', "' + value + '", checked' - else - va = ', "1", checked' - end - else - va = ', value' - end - end - if placeholder - if form - ph = ", :placeholder => '#{placeholder}'" - else - ph = ", placeholder: '#{placeholder}'" - end - end - form_html = (form ? "form.#{type} :#{name}" : "#{type} :#{name}") + va + ph + (param ? ', param' : '') - attrs.each_index { |i| form_html += (i >= attrs_used ? ', attrs[' + i.to_s + ']' : '') } - if select_prompt - if form - form_html += ', {prompt: select_prompt}' - else - form_html += ', prompt: select_prompt' - end - end - form_html += (html_options || '') - if required - form_html += ', :required => true' - end - form_html = eval(form_html) - if root - form_html = "<#{root}>" + form_html + "" - end - end - - if help - form_html = ('

' + (_ (lang_key + '.help'), :w, 20) + '

').html_safe + form_html.html_safe - end - - return ("
0 ? ' ' + classes.join(' ') : ''}\">" + (label_after ? '' : label_html) + form_html + (label_after ? label_html : '') + "
").html_safe - end - - def actions(actions = []) - if !actions.is_a?(Array) - actions = [actions] - end - - html = '
' - actions.each { |action| - if action == :facebook_sign_in - html += '' + (_ action.to_s) + '' - else - html += '' - end - } - html += '
' - html.html_safe - end - def sortable(objects, id = 'id', url: nil, &block) result = '