Skip to content

Commit

Permalink
pre model forms
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrees committed May 10, 2012
1 parent 3cb3d9a commit fe2d9dc
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 53 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/services.js.coffee
Expand Up @@ -8,5 +8,5 @@ jQuery ->
->
$(this).find('div.description').fadeIn(200, -> this.style.removeAttribute('filter'); )
->
$(this).find('div.description').stop().fadeOut()
$(this).find('div.description').clearQueue().stop().fadeOut()
)
20 changes: 12 additions & 8 deletions app/assets/javascripts/sushislider.jquery.js.coffee
@@ -1,13 +1,16 @@
# http://snook.ca/archives/javascript/simplest-jquery-slideshow

changeDetails = ->
$('#sushislider #project_who').html( $('#sushislider ul li.item:first').data('who') )
$('#sushislider #project_what').html( $('#sushislider ul li.item:first').data('what') )
$('#sushislider #project_where').html( $('#sushislider ul li.item:first').data('where') )
$('#sushislider .quote q').html( $('#sushislider ul li.item:first').data('quote') )
$('#sushislider .quote span.author').html( $('#sushislider ul li.item:first').data('quote-author') )
$('#sushislider .quote span.organisation').html( $('#sushislider ul li.item:first').data('quote-organisation') )
$('#sushislider h1').html( $('#sushislider ul li.item:first').data('name') )
$('#c-pages-a-home #sushislider #project_who').html( $('#sushislider ul li.item:first').data('who') )
$('#c-pages-a-home #sushislider #project_what').html( $('#sushislider ul li.item:first').data('what') )
$('#c-pages-a-home #sushislider #project_where').html( $('#sushislider ul li.item:first').data('where') )
$('#c-pages-a-home #sushislider .quote q').html( $('#sushislider ul li.item:first').data('quote') )
$('#c-pages-a-home #sushislider .quote span.author').html( $('#sushislider ul li.item:first').data('quote-author') )
$('#c-pages-a-home #sushislider .quote span.organisation').html( $('#sushislider ul li.item:first').data('quote-organisation') )
$('#c-pages-a-home #sushislider h1').html( $('#sushislider ul li.item:first').data('name') )

$('#c-pages-a-our_ethos #sushislider h1').html( $('#sushislider ul li.item:first').data('headline') )
$('#c-pages-a-our_ethos #sushislider .description').html( $('#sushislider ul li.item:first').data('description') )

setActive = ->

Expand Down Expand Up @@ -63,7 +66,8 @@ prev = (num=1) ->

startTimer = ->
clearInterval window.interval
window.interval = setInterval (-> next()), 3000
unless $("body#c-pages-a-our_ethos").size() > 0
window.interval = setInterval (-> next()), 3000

index = $('#sushislider li.item:first').data('index')
$('#sushislider ol li').removeClass('active')
Expand Down
21 changes: 13 additions & 8 deletions app/assets/stylesheets/application.css.scss
Expand Up @@ -39,17 +39,18 @@ $break-large: 1200px;

@mixin font-face($font-family, $url) {
@font-face {
font-family: '#{$font-family}';
src: url('#{$url}.eot?') format('eot'), url('#{$url}.woff') format('woff'), url('#{$url}.svg') format('svg'), url('#{$url}.ttf') format('truetype');
font-family: $font-family;
// src: url('#{$url}.eot?') format('eot'), url('#{$url}.woff') format('woff'), url('#{$url}.svg') format('svg'), url('#{$url}.ttf') format('truetype');
src: url('#{$url}.woff') format('woff');
}
}

@include font-face('Formata', '/assets/Formata-Regular');
@include font-face('FormataMedium', '/assets/Formata-Medium');
@include font-face('FormataItalic', '/assets/Formata-Italic');

@mixin bold { font-family: FormataMedium; font-weight: bold; }
@mixin italic { font-family: FormataItalic; font-style: italic; }
@mixin bold { font-family: FormataMedium, Tahoma, Arial, sans-serif; font-weight: normal; }
@mixin italic { font-family: FormataItalic, Tahoma, Arial, sans-serif; font-style: italic; }

$column-width: 160px !default;
$gutter-width: 10px !default;
Expand Down Expand Up @@ -202,7 +203,7 @@ body {
color: #FFF;
font-size: 14px;
min-width: 940px;
font-family: Formata;
font-family: Formata, Tahoma, Arial, sans-serif;

height: 95%;
margin: 0;
Expand Down Expand Up @@ -230,6 +231,7 @@ q p, blockquote p {
img {
margin-bottom: 10px;
}

}

#contact_details {
Expand All @@ -240,14 +242,17 @@ q p, blockquote p {
font-size: 2.1em;
padding: 0;
margin: 0;
a {
color: #FFF;
}
}
span {
display: block;
color: #C5D2F3;
}
a {
color: #C5D2F3;
}
a:hover {
color: #FFF;
}
}

.button {
Expand Down
13 changes: 11 additions & 2 deletions app/assets/stylesheets/our_ethos.css.scss
Expand Up @@ -6,8 +6,14 @@ body#c-pages-a-our_ethos {

#sushislider {



li.item {
cursor: default;
&, * {
opacity:inherit;
filter:inherit;
}
}

h1 {
Expand All @@ -17,7 +23,7 @@ body#c-pages-a-our_ethos {
}

.inner {
display:table;
// display:table;
padding: 10px 10px 10px 20px;
@include grid(4);
background: image-url('pngs/black_bg.png');
Expand All @@ -28,7 +34,10 @@ body#c-pages-a-our_ethos {
}

.inner_container {
display: table-cell;
position: absolute;
z-index: 99999;

// display: table-cell;
vertical-align:middle;
}

Expand Down
9 changes: 6 additions & 3 deletions app/assets/stylesheets/services.css.scss
Expand Up @@ -16,6 +16,11 @@ ul#services {

background: image-url('services/lighting_design.jpg');

* {
opacity:inherit;
filter:inherit;
}

.inner {
border: 1px solid $blue;
height: 460px;
Expand All @@ -33,14 +38,12 @@ ul#services {
}

.title {
@include bold;
// @include bold;
}

.description {
bottom: 1px;
font-size: 1em;
opacity:inherit;
filter:inherit;
}
}
}
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Expand Up @@ -23,4 +23,8 @@ def show_title?
@show_title
end

def mark_required(object, attribute)
"*" if object.class.validators_on(attribute).map(&:class).include? ActiveModel::Validations::PresenceValidator
end

end
1 change: 1 addition & 0 deletions app/models/ethos.rb
@@ -1,6 +1,7 @@
class Ethos < ActiveRecord::Base
attr_accessible :description, :headline, :ordinal, :image
mount_uploader :image, EthosImageUploader
validates_presence_of :headline, :description
default_scope order('ordinal ASC')
def to_s
headline
Expand Down
8 changes: 4 additions & 4 deletions app/views/admin/downloads/_form.html.erb
Expand Up @@ -3,15 +3,15 @@

<fieldset>
<div class="field">
<%= f.label :name %>
<%= f.label :name %><%= mark_required(@download, :name) %>
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :description %>
<%= f.text_area :description %>
<%#= f.label :description %>
<%#= f.text_area :description %>
</div>
<div class="field">
<%= f.label :file %>
<%= f.label :file %><%= mark_required(@download, :file) %>
<%= f.hidden_field :file_cache %>
<%= f.file_field :file %>
<%= link_to(@download.file, @download.file.url, target: '_blank') if @download.file %>
Expand Down
6 changes: 3 additions & 3 deletions app/views/admin/ethoses/_form.html.erb
Expand Up @@ -5,15 +5,15 @@
<fieldset>
<legend>Details</legend>
<div class="field">
<%= f.label :headline %>
<%= f.label :headline %><%= mark_required(@ethos, :headline) %>
<%= f.text_field :headline %>
</div>
<div class="field">
<%= f.label :description %>
<%= f.label :description %><%= mark_required(@ethos, :description) %>
<%= f.text_area :description %>
</div>
<div class="field">
<%= f.label :image %>
<%= f.label :image %><%= mark_required(@ethos, :image) %>
<%= f.file_field :image %><br/>
<%= image_tag(@ethos.image.url, width: 200) if @ethos.image.present? %>
</div>
Expand Down
10 changes: 5 additions & 5 deletions app/views/admin/projects/_form.html.erb
Expand Up @@ -5,23 +5,23 @@
<fieldset>
<legend>Details</legend>
<div class="field">
<%= f.label :name %>
<%= f.label :name %><%= mark_required(@project, :name) %>
<%= f.text_field :name, style: 'width: 300px' %>
</div>
<div class="field">
<%= f.label :who %>
<%= f.label :who %><%= mark_required(@project, :who) %>
<%= f.text_field :who, style: 'width: 300px' %>
</div>
<div class="field">
<%= f.label :where %>
<%= f.label :where %><%= mark_required(@project, :where) %>
<%= f.text_field :where, style: 'width: 300px' %>
</div>
<div class="field">
<%= f.label :what %>
<%= f.label :what %><%= mark_required(@project, :what) %>
<%= f.text_field :what, style: 'width: 300px' %>
</div>
<div class="field">
<%= f.label :description %>
<%= f.label :description %><%= mark_required(@project, :description) %>
<%= f.text_area :description %>
</div>
</fieldset>
Expand Down
8 changes: 5 additions & 3 deletions app/views/admin/services/_form.html.erb
@@ -1,14 +1,16 @@
<%= form_for ['admin',@service] do |f| %>
<%= render "application/error_messages", :target => @service %>

<fieldset>
<div class="field">
<%= f.label :name %>
<%= f.label :name %><%= mark_required(@service, :name) %>
<%= f.text_field :name %>
</div>
<div class="field">
<div class="field"><%= mark_required(@service, :description) %>
<%= f.label :description %>
<%= f.text_area :description %>
</div>
<div class="field">
<div class="field"><%= mark_required(@service, :image) %>
<%= f.label :image %><br />
<%= f.file_field :image %><br/>
<%= image_tag(@service.image.url, width: 80) if @service.image.url %>
Expand Down
9 changes: 1 addition & 8 deletions app/views/layouts/application.html.erb
Expand Up @@ -11,13 +11,6 @@
<!-- <meta name="viewport" content="width=device-width">-->
<meta name="viewport" content="width=940">
<%= stylesheet_link_tag "application", :media => "all" %>
<!--[if IE]>
<style type="text/css" media="screen">
* {
font-family: Tahoma !important;
}
</style>
<![endif]-->
<%= javascript_include_tag("//maps.googleapis.com/maps/api/js?sensor=false") if action_name == "contact" %>
<%= javascript_include_tag "application" %>
<%= javascript_include_tag "modernizr" %>
Expand All @@ -42,7 +35,7 @@
<div id="contact_details">
<div id="telephone_number">Call us on 0161 402 3271</div>
<span>to see how UrbanLites can light up your event.</span>
<span>Alternatively, send us an email to chris@urbanlites.com</span>
<span>Alternatively, send us an email to <%= mail_to "chris@urbanlites.com", "chris@urbanlites.com" %></span>
</div>
</div>
</header>
Expand Down
16 changes: 9 additions & 7 deletions app/views/pages/our_ethos.html.erb
Expand Up @@ -5,15 +5,17 @@
<a id="next" href="#">Next</a>
<div class="wrapper">
<div id="inner_wrapper">

<div class="inner_container">
<div class="inner">
<h1>aa</h1>
<div class="description">bb</div>
</div>
</div>

<ul>
<% Ethos.all.each_with_index do |ethos,index| %>
<li class="item" style="background: url(<%= ethos.image.url if ethos.image.present? %>)" data-index="<%= index %>">
<div class="inner_container">
<div class="inner">
<h1><%= ethos.headline %></h1>
<%= simple_format ethos.description %>
</div>
</div>
<li class="item" style="background: url(<%= ethos.image.url if ethos.image.present? %>)" data-index="<%= index %>" data-headline="<%= ethos.headline %>" data-description="<%= simple_format ethos.description %>">
</li>
<% end %>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion app/views/services/index.html.erb
Expand Up @@ -3,7 +3,7 @@
<% @services.each do |service| %>
<li style="background-image: url(<%= service.image.url if service.image.present? %>)">
<div class="inner">
<div class="title"><%= service.name %></div>
<h1 class="title"><%= service.name %></h1>
<div class="description"><%= service.description %></div>
</div>
</li>
Expand Down

0 comments on commit fe2d9dc

Please sign in to comment.