Skip to content

Commit

Permalink
Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikko committed Oct 20, 2011
1 parent c514eb7 commit f7dd2bd
Show file tree
Hide file tree
Showing 22 changed files with 173 additions and 59 deletions.
58 changes: 44 additions & 14 deletions app/assets/stylesheets/main.css.scss
Expand Up @@ -42,7 +42,7 @@ div#footer {
table {
width: 100%;
}
width: 490px;
width: 470px;
margin-left: 20px;
margin-right: 0px;;
}
Expand Down Expand Up @@ -83,6 +83,15 @@ div#leftcontent {
padding: 10px;
}

div.links {
p {
margin-left: 10px;
}
div#line {
border-bottom: solid 1px;
}
}

H2 {
font-family: Interstatelight !important;
font-size:160%;
Expand All @@ -106,7 +115,7 @@ H3 {
}

div#midcol {
width: 490px;
width: 470px;
float: left;
margin-top: 15px;
margin-left: 10px;
Expand All @@ -118,7 +127,7 @@ div#navigation {
width:100%;
float:left;
text-align:center;
font-family:Interstatelight, Verdana, monospace;
font-family: Interstatelight, Verdana, monospace;
font-size:120%;
}

Expand All @@ -135,7 +144,6 @@ table.navmenu {
}
}


div a.navlink {
text-decoration: none;
font-family: Interstatelight, Verdana, monospace;
Expand All @@ -155,7 +163,8 @@ td.navlink {
div table#contact {
float: right;
margin-top: -12px;
margin-right: -203px;
margin-right: -223px;
letter-spacing: 0.1em;
}

div#content {
Expand All @@ -164,7 +173,12 @@ div#content {
padding-top: 5px;
padding-left: 15px;
padding-right: 15px;
padding-bottom: 10px;}
padding-bottom: 10px;
p img {
margin-top: 2px;
margin-right: 10px;
}
}

div.actions {
text-align:right;
Expand All @@ -188,7 +202,7 @@ div#rightcol {
margin-left: 10px;
margin-bottom: 10px;
margin-right: 0px;
width: 180px;
width: 200px;
float: right;
input {
width: 160px;
Expand All @@ -199,7 +213,7 @@ div#search input#search_content_contains {
width: 154px;
}

div#login, div#search, div#events {
div#login, div#search, div#events, div.related {
background-color: #FFFFFF;
color: #000000;
font-family: Interstatelight, Verdana, Geneva;
Expand All @@ -213,16 +227,29 @@ div#login, div#search, div#events {
}
}

td.eventtitle {
a {
text-decoration: none;
}
}

td.eventmonth {
padding-top: 15px;
text-transform: uppercase;
}


div#events {
img {
width: 145px !important;
height: auto !important;
}
img.readmore {
width: 7px !important;
}
table {
width: 145px;
p {
margin-top: 0px;
margin-bottom: 0px;
}
}
}

div.backgroundtitle {
background-color:#2e3192;
color: #FFFFFF;
Expand All @@ -235,6 +262,9 @@ div.backgroundtitle {
color: #FFF;
text-decoration: none;
}
h4 {
font-weight: normal;
}
}

div.field {
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/abouts_controller.rb
@@ -1,3 +1,7 @@
class AboutsController < InheritedResources::Base
load_and_authorize_resource
def show
@agenda = Event.find(:all, :order => "date ASC", :limit => 3)
show!
end
end
24 changes: 24 additions & 0 deletions app/controllers/blogpages_controller.rb
Expand Up @@ -7,6 +7,30 @@ def index
def show
@blogpage = Blogpage.find(params[:id])
@comments = @blogpage.comments
search = []
if @blogpage.tags
search = @blogpage.tags.split(", ")
end
pages = []
profiles = []
search.each do |s|
pages << Page.where("tags LIKE ?", '%'+s+'%')
profiles << Profile.where("tags LIKE ?", '%'+s+'%')
end
@relatedpages = []
@relatedprofiles = []
pages.each do |pa|
pa.each do |page|
@relatedpages << page
end
end
profiles.each do |pr|
pr.each do |profile|
@relatedprofiles << profile
end
end
@relatedpages.uniq!
@relatedprofiles.uniq!
end

def create
Expand Down
8 changes: 7 additions & 1 deletion app/controllers/cases_controller.rb
Expand Up @@ -2,7 +2,13 @@ class CasesController < InheritedResources::Base
load_and_authorize_resource

def index
@blogpages = Blogpage.order("created_at DESC")
@cases = Case.order("created_at DESC")
@agenda = Event.find(:all, :order => "date ASC", :limit => 3)
end

def show
@agenda = Event.find(:all, :order => "date ASC", :limit => 3)
show!
end

def new
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/home_controller.rb
Expand Up @@ -3,6 +3,6 @@ def index
@sidetext = About.find(6)
@cases = Case.where(:published => true).order("created_at DESC").limit(3)
@blogpages = Blogpage.where(:published => true).order("created_at DESC").limit(3)
@agenda = Event.find(:all, :order => "date ASC", :limit => 4)
@agenda = Event.find(:all, :order => "date ASC", :limit => 3)
end
end
2 changes: 1 addition & 1 deletion app/controllers/pages_controller.rb
Expand Up @@ -2,6 +2,6 @@ class PagesController < ApplicationController
load_and_authorize_resource
def index
@search = Page.search(params[:search])
@pages = @search#.where("published=?", true) # or @search.relation to lazy load in view
@pages = @search
end
end
26 changes: 25 additions & 1 deletion app/models/profile.rb
@@ -1,2 +1,26 @@
class Profile < ActiveRecord::Base
end

def shortname
name = ""
unless self.prefix.blank?
name += self.prefix.strip + " "
end
name += self.firstname.strip + " "
unless self.middlename.blank?
name += self.middlename.strip + " "
end
name += self.lastname.strip + " "
unless self.suffix.blank?
name += self.suffix.strip
end
return name
end

def fullname
name = self.shortname
unless self.firstnamefull.blank?
name += " (" + self.firstnamefull.strip + ")"
end
return name
end
end
6 changes: 5 additions & 1 deletion app/views/abouts/_form.html.erb
Expand Up @@ -19,14 +19,18 @@
<%= f.cktext_area :content, :toolbar => 'Easy' %>
</div>
<div class="field">
<%= f.label :published %>
<%= f.check_box :published %>
<%= f.label :published %>
</div>
<% if (current_user.role == "editor") %>
<div class="field">
<%= f.label :author %>
<%= f.text_field :author %>
</div>
<div class="field">
<%= f.label :tags %>
<%= f.text_field :tags %>
</div>
<% end %>
<div class="actions">
<%= f.submit "Save" %>
Expand Down
14 changes: 9 additions & 5 deletions app/views/abouts/show.html.erb
@@ -1,10 +1,11 @@
<% content_for :leftcol do %>
<div class='links'><h4>design united /
<div id='leftcontent'>
<div class='links'><h4>design united /</h4>
<% if @about.id == 1 %>
<b>about /</b>
<% else%>
<%= link_to "about /", aboutdu_path %>
<% end %></h4><p>
<% end %><p>
<% if @about.id == 2 %>
<b>introduction /</b>
<% else%>
Expand All @@ -24,13 +25,16 @@
<b>contact /</b>
<% else%>
<%= link_to "contact /", contact_path %>
<% end %></p></div>
</p>
<% end %></p><div id="line"></div></div>
</div>
<% end %>
<div><h2><%= @about.title %></h2></div>
<div class="actions">
<% if can? :update, @about %>
<%= link_to "Edit", edit_about_path(@about) %>
<% end %>
</div>
<%= raw @about.content %>
<%= raw @about.content %>
<% content_for :rightcol do %>
<%= render :partial => "events" %>
<% end %>
19 changes: 10 additions & 9 deletions app/views/application/_events.html.erb
Expand Up @@ -7,20 +7,21 @@
<tr><td class="eventmonth" colspan=2><%= l(event.date, :format => "%B") %></td></tr>
<% end %>
<tr><td><%= l(event.date, :format => "%d") %></td>
<td class="eventtitle"><b>
<% if event.external_link %>
<%= link_to event.title, event.external_link %>
<% else %>
<td class="eventtitle">
<% if event.external_link.blank? %>
<%= link_to event.title, event %>
<% end %></b>
<% else %>
<%= link_to event.title, event.external_link %>
<% end %>
</td></tr>
<tr><td/>
<td> <%= strip_tags(event.content) %><br/>
<td> <%= truncate_html(event.content, :length => 80, :omission => "..") %>
<% if event.external_link %>
<%= link_to "read more", event.external_link, :class => "readmore" %> <img src='/images/color_slash.gif'>
<%= link_to "read more", event.external_link, :class => "readmore" %> <img class="readmore" src='/images/color_slash.gif'>
<% else %>
<%= link_to "read more", event, :class => "readmore" %> <img src='/images/color_slash.gif'>
<%= link_to "read more", event, :class => "readmore" %> <img class="readmore" src='/images/color_slash.gif'>
<% end %></td>
</tr>
<% end %>
</table>
</table><p>
<%= link_to "more events", events_path, :class => "readmore" %> <img class="readmore" src='/images/color_slash.gif'></p>
2 changes: 1 addition & 1 deletion app/views/application/_search.html.erb
@@ -1,5 +1,5 @@
<% @search = Page.search(params[:search]) %>
<%= form_for @search do |f| %>
<%= f.text_field :content_contains, :size => '30' %>
<%= f.text_field :content_contains %>
<%= f.submit "Search" %>
<% end %>
4 changes: 4 additions & 0 deletions app/views/blogpages/_form.html.erb
Expand Up @@ -28,6 +28,10 @@
<%= f.label :author %>
<%= f.text_field :author %>
</div>
<div class="field">
<%= f.label :tags %>
<%= f.text_field :tags %>
</div>
<% end %>
<div class="actions">
<%= f.submit "Save" %>
Expand Down
5 changes: 4 additions & 1 deletion app/views/blogpages/show.html.erb
Expand Up @@ -25,4 +25,7 @@
<% if @comments.blank? %>
<p>No comments were found.</p>
<% end %>
<%= link_to "Add comment", new_blogpage_comment_path(@blogpage, Comment.new) %>
<%= link_to "Add comment", new_blogpage_comment_path(@blogpage, Comment.new) %>
<% content_for :rightcol do %>
<%= render :partial => "related" %>
<% end %>
4 changes: 4 additions & 0 deletions app/views/cases/_form.html.erb
Expand Up @@ -28,6 +28,10 @@
<%= f.label :author %>
<%= f.text_field :author %>
</div>
<div class="field">
<%= f.label :tags %>
<%= f.text_field :tags %>
</div>
<% end %>
<div class="actions">
<%= f.submit "Save" %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/cases/index.html.erb
Expand Up @@ -15,4 +15,7 @@
</div>
<%= truncate_html(page.content, :length => 400, :omission => '...') %>
<%= link_to "read more", page, :class => "readmore" %> <img src='/images/color_slash.gif'>
<% end %>
<% content_for :rightcol do %>
<%= render :partial => "events" %>
<% end %>
5 changes: 4 additions & 1 deletion app/views/cases/show.html.erb
Expand Up @@ -7,4 +7,7 @@
<%= link_to "Delete", @case, :confirm => "Are you sure you want to delete "+@case.title+"?\nThis action cannot be undone!", :method => :delete %>
<% end %>
</div>
<%= raw @case.content %>
<%= raw @case.content %>
<% content_for :rightcol do %>
<%= render :partial => "events" %>
<% end %>
4 changes: 4 additions & 0 deletions app/views/events/_form.html.erb
Expand Up @@ -37,6 +37,10 @@
<%= f.label :external_link %>
<%= f.text_field :external_link %>
</div>
<div class="field">
<%= f.label :tags %>
<%= f.text_field :tags %>
</div>
<div class="actions">
<%= f.submit "Save" %>
</div>
Expand Down

0 comments on commit f7dd2bd

Please sign in to comment.