Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

html -> haml

  • Loading branch information...
commit 946de17d0ed248141024a067af5cba8f42e93939 1 parent 4ae2ca9
@carboes authored
View
27 app/controllers/admin/events_controller.rb
@@ -1,4 +1,6 @@
require 'gcal4ruby'
+require 'rexml/document'
+
module Admin
class EventsController < Admin::BaseController
before_filter :find_categories, :except => :index
@@ -37,7 +39,7 @@ def find_categories
end
def find_map_locations
- @map_locations = MapLocation.all
+ @map_locations = MapLocation.all.sort_by { |f| [-f.main_centre, f.title] }
end
def get_setting(name)
@@ -60,19 +62,32 @@ def find_calendar
def update_google_event(event)
find_calendar
- if event.google_event_id
- g_event = GCal4Ruby::Event.find(@service, {:id => event.google_event_id})
- else
+
+ unless event.google_event_id.to_s.empty?
+ g_event = GCal4Ruby::Event.find(@service, {:id => event.google_event_id})
+ end
+ unless g_event
g_event = GCal4Ruby::Event.new(@service)
g_event.calendar = @calendar
end
- g_event.title = event.title
+
+ categories = event.categories.collect { |c| c.name }.join(', ')
+ categories = " [#{categories}]" unless categories.empty?
+ g_event.title = event.title+categories
+
g_event.where = event.map_location.full_address
g_event.start_time = Time.parse(event.start_at.strftime("%d/%m/%Y at %I:%M%p"))
g_event.end_time = Time.parse(event.end_at.strftime("%d/%m/%Y at %I:%M%p"))
+
+ content = event.description.gsub(/<\/?[^>]*>/, "") #removes html
+ content = event.subtitle + "\n\n" + content unless event.subtitle.empty?
+ g_event.content = content
+
g_event.save
+ ##debugger
+ ##doc = REXML::Document.new(g_event.to_xml).element('link')['href']
##somehow get another eid from the to_xml() method that will be used to add to calendar
- event.update_attributes(:google_event_id => g_event.id) unless event.google_event_id
+ event.update_attributes(:google_event_id => g_event.id)
end
end
View
11 app/controllers/events_controller.rb
@@ -17,7 +17,13 @@ def show
@map_location = MapLocation.find(params[:map_location_id]) if params[:map_location_id]
# you can use meta fields from your model instead (e.g. browser_title)
# by swapping @page for @event in the line below:
- present(@page)
+
+
+ if request.xhr?
+ render(partial: "event", :locals => {:event => @event})
+ else
+ present(@page)
+ end
end
def archive
@@ -51,6 +57,7 @@ def find_all_events
featured_upcoming = Event.upcoming.featured
featured_current = Event.current.featured
@featured_events = (featured_upcoming | featured_current).sort { |a,b| a.start_at <=> b.start_at }
+ @upcoming_events = (Event.upcoming | Event.current).sort { |a,b| a.start_at <=> b.start_at }
@other_events = Event.live.limit(5)
end
@@ -62,5 +69,5 @@ def find_page
def find_categories
@event_categories = EventCategory.all
end
-
+
end
View
93 app/views/admin/events/_form.haml
@@ -0,0 +1,93 @@
+= form_for [:admin, @event] do |f|
+ = render :partial => "/shared/admin/error_messages", :locals => { |
+ :object => @event, |
+ :include_object_name => true |
+ } |
+ .field
+ = f.label :title
+ = f.text_field :title, :class => 'larger widest'
+ .field
+ = f.label :subtitle
+ = f.text_field :subtitle, :class => 'larger widest'
+ - if @event_categories.any?
+ .field
+ %h2 Categories
+ %ul.check_box_list
+ - @event_categories.each do |category|
+ %li
+ = check_box_tag 'event[category_ids][]', category.id, |
+ @event.categories.include?(category), |
+ :id => (id="event_category_ids_#{category.id}") |
+ -#
+ = label_tag 'event[category_ids][]', category.name, |
+ :class => 'stripped', |
+ :for => id |
+ .field
+ = f.label :start_at
+ = f.datetime_select :start_at, :default => Time.now.change(:hour => 12, :minute => 0)
+ .field
+ = f.label :end_at
+ = f.datetime_select :end_at, :default => Time.now.change(:hour => 13, :minute => 0)
+ .field
+ #page-tabs.clearfix.ui-tabs.ui-widget.ui-widget-content.ui-corner-all
+ %ul#page_parts
+ - [:description].each_with_index do |part, part_index|
+ <li class='ui-state-default#{' ui-state-active' if part_index == 0}'>
+ \#{link_to part.to_s.titleize, "##{part}"}
+ #page_part_editors
+ - [:description].each do |part|
+ .page_part{:id => part}
+ = f.text_area part, :rows => 20, :class => 'wymeditor widest'
+ .field
+ = f.label :image
+ = render :partial => "/shared/admin/image_picker", :locals => { |
+ :f => f, |
+ :field => :image_id, |
+ :image => @event.image, |
+ :toggle_image_display => false |
+ } |
+ .field
+ = f.label 'Location', :for => 'map_location'
+ = select_tag 'event[map_location_id]', options_from_collection_for_select(@map_locations, :id, :title, @event.map_location_id), :id => 'map_location'
+ .field
+ = f.label :ticket_price
+ \£ #{f.text_field :ticket_price}
+ .field
+ = f.label :ticket_link
+ = f.text_field :ticket_link, :class => 'larger wide'
+ .field
+ %p
+ = f.check_box :featured
+ = f.label :featured, "Featured event", :class => 'stripped'
+ .field
+ = render :partial => "/calendar/event", |
+ :locals => { |
+ :google_event_id => @event.google_event_id |
+ } |
+ = render :partial => "/shared/admin/form_actions", |
+ :locals => { |
+ :f => f, |
+ :continue_editing => false, |
+ :delete_title => t('delete', :scope => 'admin.events.event'), |
+ :delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @event.title) |
+ } |
+- content_for :javascripts do
+ :javascript
+ $(document).ready(function(){
+ page_options.init(false, '', '');
+ });
+ - content_for :stylesheets do
+ :css
+ ul.check_box_list{
+ list-style:none;
+ margin:10px 0;
+ padding:5px;
+ border:1px solid #333;
+ overflow:auto;
+ height:200px;
+ width:300px;
+ }
+ ul.check_box_list li{
+ list-style:none;
+ margin:5px 0;
+ }
View
5 app/views/admin/events/_form.html.erb
@@ -9,6 +9,11 @@
<%= f.text_field :title, :class => 'larger widest' -%>
</div>
+ <div class='field'>
+ <%= f.label :subtitle -%>
+ <%= f.text_field :subtitle, :class => 'larger widest' -%>
+ </div>
+
<% if @event_categories.any? -%>
<div class='field'>
<h2>Categories</h2>
View
64 app/views/events/_event.haml
@@ -0,0 +1,64 @@
+- featured ||= false
+- individual ||= false
+- archive ||= false
+- category ||= false
+
+= div_for event, :'data-id' => event.id, :class => 'individual_event clearfix' do
+ %section.event_image
+ = image_fu event.image
+
+ %p
+ %button.book Book now
+
+ %section.event_info
+ /- unless individual
+ %h2
+ = event.title#link_to , event
+ %h3
+ = event.subtitle
+
+ /%section
+ = raw event.description
+
+ .event_details.clearfix
+ .item
+ %label Date:
+ .value
+ = event.start_at.strftime('%b %e, %l:%M%p - ')
+ - unless event.start_at.strftime('%b %e') == event.end_at.strftime('%b %e')
+ = event.end_at.strftime('%b %e')
+ = event.end_at.strftime('%l:%M %p')
+
+ - if event.map_location
+ .item
+ %label Venue:
+ .value
+ = event.map_location.title
+ %br
+ = event.map_location.address
+ %br
+ = event.map_location.city
+ %br
+ = event.map_location.postcode
+
+ /%section.price
+ - if event.ticket_price?
+ %p
+ %label Cost:
+ = number_to_currency event.ticket_price
+
+
+ / = render :partial => '/map_locations/map_single', :locals => {:map_location => event.map_location}
+
+
+
+ / - if individual
+ / %section#share_this_event
+ / %ul
+ / %li.facebook
+ / %script{src:'http://connect.facebook.net/en_US/all.js#xfbml=1'}
+ / %fb:like{href: request.url, layout: "box_count", show_faces: false, width: 55, font:""}
+ / %li.twitter
+ / %a.twitter-share-button{href:"http://twitter.com/share", :'data-count' => "vertical"}Tweet
+ / %script{src:'http://platform.twitter.com/widgets.js', type: "text/javascript"}
+
View
0  app/views/events/_event.html.erb → app/views/events/_event.html.erb.old
File renamed without changes
View
58 app/views/events/_sidebar.haml
@@ -0,0 +1,58 @@
+/ - content_for :meta, "
+/ <link
+/ rel='alternate'
+/ type='application/rss+xml'
+/ title='#{RefinerySetting.find_or_set(:site_name, 'Company Name')} Events'
+/ href='#{events_url(:format => :rss)}' />".html_safe
+- content_for :body_content_right do
+
+ #events_sidebar
+
+ #booking_items
+ %h2 My Bookings
+ %aside.sidebar_module
+ %ul
+ %button.checkout Checkout
+ %button.clear Clear
+
+ / %aside.sidebar_module.rss
+ / %h3 RSS
+ / = link_to "Subscribe", events_path(:format => :rss)
+ .panel
+ %h2 Upcoming Courses
+ %aside.sidebar_module.events
+ %ul
+ - @upcoming_events.each do |event|
+ %li.clearfix{:'data-id' => event.id}
+ /.image
+ = image_fu event.image, "60x80#c"
+ /.caption
+ = link_to "#{event.title}", event_url(event)
+ %br
+ = event.subtitle
+ %br
+ %span.date
+ = event.start_at.strftime("%a, %b %d")
+ - if event.start_at.strftime("%b %d") != event.end_at.strftime("%b %d")
+ %br
+ = "- "+event.end_at.strftime("%a, %b %d")
+
+ / %h2 Categories
+ / %aside.sidebar_module.categories
+ / %ul
+ / - @event_categories.each do |category|
+ / %li
+ / = link_to category.name+'s', category_events_path(category)
+
+ / - unless controller.action_name == "index" or controller.action_name == "archive"
+ / %aside.sidebar_module.other_events
+ / %h2
+ / = t('.other')
+ / %ul#events
+ / - @other_events.each do |event|
+ / %li
+ / = link_to event.title, event_url(event)
+ .panel
+ %h2 Archives
+ %aside.sidebar_module.archives
+ = events_archive_list
View
0  app/views/events/_sidebar.html.erb → app/views/events/_sidebar.html.erb.old
File renamed without changes
View
11 app/views/events/_widget.haml
@@ -0,0 +1,11 @@
+%ul
+ - events.each do |event|
+ %li{:'data-id' => event.id}
+ /.image
+ = image_fu event.image, "60x50#c"
+ /.caption
+ = link_to "#{event.title}", event_url(event)
+ %span.date
+ = event.start_at.strftime("%b %d")
+ %br
+ = event.subtitle
View
20 app/views/events/index.haml
@@ -0,0 +1,20 @@
+- content_for :jquery do
+ = javascript_include_tag '/javascripts/compiled/controllers/events.js'
+ = javascript_include_tag '/javascripts/compiled/controllers/bookings.js'
+
+- content_for :stylesheets do
+ /= stylesheet_link_tag 'refinerycms-events'
+
+
+/- content_for :body_content_left do
+/ #featured_events.events
+/ /%h2 Events
+/#events
+/ = render :partial => 'event', :collection => @upcoming_events#, :locals => { :featured => true }
+/ #all_events.events
+/ %h2 All Events
+/= render :partial => 'event', :collection => @events
+
+= render 'events/sidebar'
+
+= render :partial => "/shared/content_page"
View
17 app/views/events/index.html.erb
@@ -1,17 +0,0 @@
-<% content_for :body_content_left do %>
- <div id="featured_events" class="events">
- <h2>Featured Events</h2>
- <%= render :partial => 'event', :collection => @featured_events, :locals => { :featured => true } %>
- </div>
-
- <div id="all_events" class="events">
- <h2>All Events</h2>
- <%= render :partial => 'event', :collection => @events %>
- </div>
-<% end %>
-
-<%= render 'events/sidebar' %>
-
-<%= render :partial => "/shared/content_page" %>
-
-<% content_for :stylesheets, stylesheet_link_tag('refinerycms-events') %>
View
13 app/views/events/show.haml
@@ -0,0 +1,13 @@
+- content_for :jquery do
+ = javascript_include_tag '/javascripts/compiled/controllers/events.js'
+
+- content_for :stylesheets do
+ = stylesheet_link_tag 'refinerycms-events'
+
+- content_for :body_content_title do
+ /= @event.title
+- content_for :body_content_left do
+ #events
+ = render :partial => 'event', :locals => { :event => @event, :individual => true }
+= render 'events/sidebar'
+= render :partial => "/shared/content_page"
View
15 app/views/events/show.html.erb
@@ -1,15 +0,0 @@
-<% content_for :body_content_title do %>
- <%= @event.title %>
-<% end %>
-
-<% content_for :body_content_left do %>
- <div id="event">
- <%= render :partial => 'event', :locals => { :event => @event, :individual => true } %>
- </div>
-<% end %>
-
-<%= render 'events/sidebar' %>
-
-<%= render :partial => "/shared/content_page" %>
-
-<% content_for :stylesheets, stylesheet_link_tag('refinerycms-events') %>
View
48 app/views/events/untitled 127.txt
@@ -0,0 +1,48 @@
+digital white - digital design
+-front end, javascript
+technical director
+zsolt szlai - 12.30...
+
+tech geared around ajax/js
+
+throughout career have always had a script client-side focus in all my apps
+
+- image bank (started using yui)
+- incite (was the main js developer)
+--- developed the project management tools key UIs.... basically message and document management systems - looks like an email client.
+---- jsgrid, tree
+---- ashx handlers, or web services generating the json.
+
+used SVG back in the day, when i built a software arhiectture modelling tool (components, and relations... bezier curve)
+
+- ukbound - some basic javascript.
+- dreamcatcher - image bank...
+---- using ajax to load partials, REST, xhr call to return the page partial, and inject it in the page
+---- ejs template for javascript, just fire in a json object.
+animation - mainly just sticking to js animation, and linking different
+
+javascript MVC, models views and controllers....
+jqueryMX - jquery.controller, jquery.classes.... views are templates (such as ejs files writting with a combination of html and js)
+
+coffeescript to keep code nice and neat
+
+haml, sass
+
+started off an a c# developer - modifying the css elements
+call another animation once complete...
+
+polymorphism (2 objects using the same methods - different classes have diff behaviours for the same)
+encapulsation (methods within a object)
+inheritance (inheriting a parent classes)
+
+controllers relate to specific functionality or a comonent (meta menu, entryfield, imagebank)
+$.get, %.ajax methods to get the object from a particular link
+- the rest standard, but in AJAX can use ashx (if on the same web application)
+
+
+
+
+
+financial company
+
+investorB
View
78 public/stylesheets/refinerycms-events.css
@@ -1,73 +1,73 @@
-.individual_event {
- padding: 15px;
- margin: 0 0 10px;
- background-color: #f4f4f4;
+/*.individual_event {
+ padding: 15px;
+ margin: 0 0 10px;
+ background-color: #f4f4f4;
}
.individual_event h1 {
- margin: 0 0 10px;
- padding: 0;
+ margin: 0 0 10px;
+ padding: 0;
}
.individual_event .event_image {
- float: left;
- margin: 0 15px 10px 0;
+ float: left;
+ margin: 0 15px 10px 0;
}
#featured_events h2 {
- margin: 15px 0 10px;
+ margin: 15px 0 10px;
}
.sidebar_module {
- padding: 15px;
+ padding: 15px;
}
.sidebar_module h2 {
- margin: 0 0 10px;
+ margin: 0 0 10px;
}
.categories a {
- display: block;
- margin: 5px 0;
+ display: block;
+ margin: 5px 0;
}
.sidebar_module ul {
- list-style: square;
- padding: 0 0 0 26px;
- margin: 0;
+ list-style: square;
+ padding: 0 0 0 26px;
+ margin: 0;
}
.sidebar_module ul li {
- margin: 2px 0;
- padding: 2px 0;
+ margin: 2px 0;
+ padding: 2px 0;
}
#share_this_event {
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
- padding: 20px 0;
- margin: 20px 0;
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ padding: 20px 0;
+ margin: 20px 0;
}
#share_this_event ul {
- list-style: none;
- border: 0;
- padding: 0;
- margin: 0;
+ list-style: none;
+ border: 0;
+ padding: 0;
+ margin: 0;
}
#share_this_event ul li {
- float: left;
- height: 70px;
- margin: 0 15px 0 0;
+ float: left;
+ height: 70px;
+ margin: 0 15px 0 0;
}
#prevnext_nav {
- clear: both;
- display: block;
- height: 100px;
+ clear: both;
+ display: block;
+ height: 100px;
}
#prevnext_nav .prev {
- width: 33%;
- float: left;
+ width: 33%;
+ float: left;
}
#prevnext_nav .home {
- width: 33%;
- float: left;
+ width: 33%;
+ float: left;
}
#prevnext_nav .next {
- width: 33%;
- float: left;
+ width: 33%;
+ float: left;
}
-
+ */
Please sign in to comment.
Something went wrong with that request. Please try again.