Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

working with layout of polls

  • Loading branch information...
commit d2d896e9c92170baa3683bd76e55eb00adb702b9 1 parent 4e57318
@yeban authored
View
4 app/controllers/tags.rb
@@ -4,8 +4,10 @@ class Tags < Application
def show(id)
tag = Tag.get id
raise NotFound unless tag
- @result = {}
+ @result = {:tweets => [], :group => [], :polls => []}
@result [:tweets] = Tweet.all('taggings.tag_id' => id)
+ @result [:groups] = Group.all('taggings.tag_id' => id)
+ @result [:polls] = Poll.all('taggings.tag_id' => id)
render @result
end
View
6 app/models/poll.rb
@@ -3,7 +3,7 @@ class Poll
property :id, Serial
property :topic, String, :nullable => false
- property :description, Text
+ property :description, Text, :laxy => false
property :published, Boolean
property :closing_date, Date, :set => ((Date.today + 1)..1.0/0)
property :editable, Boolean
@@ -32,4 +32,8 @@ def status
end
end
+ def votes
+ Vote.all('poll_choice.poll_id' => id).count
+ end
+
end
View
18 app/views/groups/_groups.html.haml
@@ -1,5 +1,5 @@
- groups.each do |group|
- %li
+ %li.message
%span.imgn
= image_tag group.image.url(:thumb), :height=>'50px'
%span.body
@@ -8,16 +8,12 @@
%span.content
= group.description[0..139]
%span.meta
- == Owner:- #{link_to group.owner.nick, url(:profile, group.owner.nick)}
- = group.protected? ? 'Moderated': 'Open'
- - if group.protected?
- == Moderators:-
- - group.moderators.each do |moderator|
- = link_to moderator.nick, url(:profile, moderator.nick)
- - if not group.tags.empty?
- == Tags:-
- - group.tag_list.each do |tag|
- = tag
+ = image_tag 'tag_blue.png', :class => 'action-icon'
+ = group.tags.empty? ? "None" : group.tag_list.join(', ')
+ %br
+ = group.protected? ? "#{image_tag 'lock.png', :class => 'action-icon'} Closed" : "#{image_tag 'lock_open.png', :class => 'action-icon'} Open"
+ = image_tag 'user_red.png', :class => 'action-icon', :title => 'Moderators'
+ = ( group.moderators.collect { |moderator| link_to moderator.nick, url(:profile, moderator.nick) } ).join(', ')
%span.actions
= link_to(image_tag('application_edit.png', :class => 'action-icon'), url(:group, group), :title => 'View')
%br
View
2  app/views/groups/index.html.haml
@@ -1,4 +1,4 @@
%h2 Groups
%ol#groups.list
- = partial 'groups', :groups
+ = partial 'groups', :groups => @groups
- throw_content :for_sidebar, partial('sidebar')
View
20 app/views/polls/_polls.html.haml
@@ -0,0 +1,20 @@
+- polls.each do |poll|
+ %li.message
+ %span.imgn
+ = image_tag poll.user.image.url(:thumb), :height=>'50px'
+ %span.body
+ %span.content
+ = poll.description
+ %span.meta
+ = image_tag('vote_icon.png', :class => 'action-icon')
+ == #{poll.votes} Votes
+ = image_tag 'tag_blue.png', :class => 'action-icon'
+ = poll.tags.empty? ? "None" : poll.tag_list.join(', ')
+ %br
+ = image_tag 'user_red.png', :class => 'action-icon', :title => 'Owner'
+ = link_to poll.user.nick, url(:user, poll.user)
+ %span.actions
+ = link_to(image_tag('vote_icon.png', :class => 'action-icon'), url(:poll, poll), :title => 'View')
+ %br
+ - if session.user == poll.user
+ = link_to(image_tag('icon_trash.gif', :class => 'action-icon', :title => 'Delete this Message'), url(:delete_poll, poll))
View
28 app/views/polls/index.html.haml
@@ -1,26 +1,4 @@
-%h2
- - action = request.params[:action] == 'index' ? 'open' : request.params[:action]
- = action.capitalize
- Polls
-- if @polls.blank?
- .notice
- No
- = action
- polls
-%table{:width => "100%"}
- - for poll in @polls
- %tr{:class => cycle('odd','')}
- %td
- = link_to poll.topic, resource(poll)
- %td
- by
- = link_to poll.user.nick, resource(poll.user)
- %td
- = Vote.all('poll_choice.poll_id' => poll.id).count
- votes
- %td
- = poll.status
- - if poll.status == :open
- == (closes #{poll.closing_date})
-
+%h2 Polls
+%ol#polls.list
+ = partial 'polls', :polls => @polls
- throw_content :for_sidebar, partial('sidebar')
View
BIN  public/images/lock.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  public/images/lock_open.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  public/images/user_red.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  public/images/vote_icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  public/images/votes.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
6 public/stylesheets/style.css
@@ -82,8 +82,12 @@ li.nav-panel a:hover {
font-weight:bold
}
-a, a:hover, a:visited {
+a, a:visited {
text-decoration:none;
+}
+
+a:hover {
+ text-decoration:underline;
}
a{
Please sign in to comment.
Something went wrong with that request. Please try again.