Permalink
Browse files

UI wip

  • Loading branch information...
1 parent 1a200f1 commit 79e1e58a12afdca4def1f46f64b3977cbd380a86 @ionmx ionmx committed Mar 15, 2012
@@ -33,7 +33,7 @@ $('#share-message')
$('#share-button').show()
$('#share-close').show()
$('#post_content').autogrow()
- $('#to_groups').tokenInput("/groups/search")
+ $('#to_groups').tokenInput("/g/search")
$('#post_content').focus()
)
)
@@ -87,7 +87,7 @@ getShareForm = () ->
)
getGroupList = () ->
- url = '/groups/list'
+ url = '/g/list'
$.get(url, {}, (html) ->
$('#nav').html(html)
)
@@ -186,26 +186,56 @@ $('.get-group')
currentGroup = $(this).attr('group_id')
$('#container').html(status);
$("#li_group_#{currentGroup}").addClass('selected')
+ title = $("#group_link_#{currentGroup}").html()
+ $('#nav-title-span').html(title)
+ $('#nav-title-span').removeClass('font-20')
+ $('#nav-title-span').removeClass('font-22')
+ if (title.length > 20)
+ $('#nav-title-span').addClass('font-16')
+ else
+ $('#nav-title-span').addClass('font-22')
getPosts()
getGroupBrick(currentGroup)
)
$('.get-page')
.live('ajax:success', (data, status, xhr) ->
window.location.hash = '#!/g/' + $(this).attr('group_name') + '/' + $(this).attr('short_name')
- #$("#li_group_#{currentGroup}").removeClass('selected')
- #currentGroup = $(this).attr('group_id')
- $('#container').html(status);
- #$("#li_group_#{currentGroup}").addClass('selected')
+ $('.page-title').removeClass('selected')
+ $('#posts-area').html(status);
+ $('#li_page_' + $(this).attr('page_id')).addClass('selected')
)
+$('#add_page')
+ .live("ajax:beforeSend", (evt, xhr, settings) ->
+ # TODO: Display spinner
+ )
+ .live("ajax:success", (evt, data, status, xhr) ->
+ res = $.parseJSON(xhr.responseText)
+ url = '/g/' + currentGroup + '/page_list'
+ $.get(url, {}, (html) ->
+ $("#pages-list").html(html)
+ $("#page_link_" + res['id']).click()
+ )
+ $('#edit-page').hide()
+ $('#group-page').show()
+ $('#page-toolbar').show()
+ )
+ .live('ajax:complete', (evt, xhr, status) ->
+ # Complete
+ )
+ .live("ajax:error", (evt, xhr, status, error) ->
+ # TODO: Display errors
+ )
+
+
getGroupBrick = (group) ->
#$("#right-sidebar-content").html('')
- #url = '/groups/' + group + '/members'
+ #url = '/g/' + group + '/members'
#$.get(url, {}, (html) ->
# $("#right-sidebar-content").append(html)
- # url = '/groups/' + group + '/page_list'
+ # url = '/g/' + group + '/page_list'
# $.get(url, {}, (html) ->
# $("#right-sidebar-content").append(html)
# )
@@ -228,12 +258,12 @@ $('.get-user')
$('#get-home')
.live('click', () ->
- getHome()
+ getHome(true)
)
$('#brand')
.live('click', () ->
- getHome()
+ getHome(true)
)
getUpcomingEvents = () ->
@@ -255,19 +285,32 @@ $('#share-block')
getShareForm()
)
-getHome = () ->
- window.history.pushState('', document.title, window.location.pathname)
- currentGroup = 0
- currentPost = 0
- currentUser = 0
- #$("#container").html('')
- getGroupList()
+
+populateHome = () ->
+ $('.group-title').removeClass('selected')
+ $('.home-link').addClass('selected')
+ $('#nav-title-span').html($('#get-home').html())
getPosts()
getUpcomingEvents()
getUpcomingBirthdays()
+getHome = (reload) ->
+ #window.history.pushState('', document.title, window.location.pathname)
+ currentGroup = 0
+ currentPost = 0
+ currentUser = 0
+ if (reload)
+ url = '/home/index'
+ $.get(url, {}, (html) ->
+ $("#container").html(html)
+ populateHome()
+ )
+ else
+ populateHome()
+
$ ->
- getHome()
+ getGroupList()
+ getHome(false)
recentTimer = setInterval(getRecentPostsCounter, 10000)
@@ -3,7 +3,7 @@
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$('#edit-page-button')
.live('click', () ->
- $('#group-page').hide()
+ $('#group-page-contents').hide()
$('#page-toolbar').hide()
$('#edit-page').fadeIn()
)
@@ -13,9 +13,9 @@ $('#edit_page_form')
# TODO: Display saving spinner
)
.live("ajax:success", (evt, data, status, xhr) ->
- res = $.parseJSON(xhr.responseText);
- $("#page_link_" + res['id']).html(res['title']);
- $("#page_link_" + res['id']).attr('short_name', res['short_name']);
+ res = $.parseJSON(xhr.responseText)
+ $("#page_link_" + res['id']).html(res['title'])
+ $("#page_link_" + res['id']).attr('short_name', res['short_name'])
$("#page_link_" + res['id']).click();
$('#edit-page').hide()
$('#group-page').show()
@@ -27,4 +27,3 @@ $('#edit_page_form')
.live("ajax:error", (evt, xhr, status, error) ->
# TODO: Display errors
)
-
@@ -142,3 +142,18 @@ input[type=submit] {
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
color: $white;
}
+
+.font-10 { font-size: 10px; }
+.font-12 { font-size: 12px; }
+.font-14 { font-size: 14px; }
+.font-16 { font-size: 16px; }
+.font-18 { font-size: 18px; }
+.font-20 { font-size: 20px; }
+.font-22 { font-size: 22px; }
+.font-24 { font-size: 24px; }
+
+
+#tinymce {
+ background: #fff;
+ padding: 10px;
+}
@@ -67,9 +67,22 @@ ul.page-list {
display: block;
}
&#li_add_page {
- color: $grey;
+ border-top: 1px dashed $line-color;
+ margin-top: 5px;
+ a {
+ padding-top: 5px;
+ color: $grey;
+ }
+ .share-plus {
+ color: $plus-color;
+ font-weight: bold;
+ }
&:hover {
color: $black;
+ background-color: $white;
+ a {
+ color: $black;
+ }
}
}
}
@@ -78,12 +91,27 @@ ul.page-list {
#group-members {
- margin: 10px 0;
+ margin: 10px 10px 20px 10px;
}
.member {
- a {
- text-decoration: none;
- margin-right: 1px;
- }
+ float: left;
+ margin-right: 5px;
+}
+
+#group-pages {
+ margin: 10px 10px 20px 10px;
+}
+
+#group-page {
+ @include shadow(4px,1px,1px,#aaa);
+ width: ($post-width * 2) + 20;
+ margin: 10px;
+ background: #fff;
+ float: left;
+ min-height: 48px;
+}
+
+#group-page-inner {
+ margin: 20px 20px 40px 20px;
}
@@ -58,8 +58,8 @@
#nav {
float: left;
- width: $post-width;
- margin: 12px 10px 0px 10px;;
+ width: $container-width / 2;
+ margin: 12px 10px 0px 10px;
#nav-title {
color: $strong-color;
font-weight: bold;
@@ -72,6 +72,9 @@
&:hover img {
@include opacity(1);
}
+ #nav-title-span {
+ white-space: nowrap;
+ }
}
}
}
@@ -4,6 +4,7 @@
#edit-page {
display: none;
+ width: ($post-width * 2) - 20;
}
.edit-page-title {
@@ -20,7 +21,7 @@
font-size: 18px;
color: $black;
font-weight: bold;
- width: 100%;
+ width: ($post-width * 2) - 30;
}
}
@@ -29,10 +30,15 @@
}
#page-editor {
- height: 480px;
+ height: 500px;
+ width: ($post-width * 2) - 30;
padding: 10px;
}
+#page-editor_tbl {
+ width: ($post-width * 2) - 30;
+}
+
#page-toolbar {
float: right;
img {
@@ -52,5 +58,8 @@
#save-page-button {
float: right;
- margin-top: 10px;
+ margin: 10px 0 40px 0;
}
+
+
+
@@ -58,11 +58,15 @@
.post-group {
margin-left: 10px;
font-size: 10px;
+ color: $group-color;
background-color: $group-bg-color;
display: inline;
- color: $group-color;
@include rounded(4px);
padding: 2px 10px;
+ a {
+ color: $group-color;
+ &:hover { text-decoration: none; }
+ }
}
}
@@ -1,6 +1,10 @@
class ApplicationController < ActionController::Base
protect_from_forgery
+ def not_found
+ raise ActionController::RoutingError.new('Not Found')
+ end
+
def set_global_vars
user = User.find(session[:user].id)
@current_user_pic = user.image_url(:small).to_s
@@ -19,7 +19,9 @@ def page_list
end
def show
- @group = Group.find(params[:id])
+ @group = Group.where(:short_name => params[:short_name]).first || not_found
+ @user = User.find(session[:user].id)
+ @members = Membership.where(:group_id => @group.id)
render :layout => false
end
@@ -4,5 +4,8 @@ class HomeController < ApplicationController
def index
@user = User.find(session[:user].id)
+ if request.xhr?
+ render :layout => false
+ end
end
end
@@ -36,7 +36,15 @@ def add_page
page.group_id = params[:group_id]
page.user_id = user.id
page.save
- render :inline => "TODO"
+ respond_with do |format|
+ format.html do
+ if request.xhr?
+ json = {}
+ json[:id] = page.id
+ render :json => json
+ end
+ end
+ end
end
def update
@@ -1,4 +1,8 @@
class Membership < ActiveRecord::Base
belongs_to :user;
belongs_to :group;
+
+ def can_publish?
+ can_publish == 1
+ end
end
@@ -0,0 +1,9 @@
+.post
+ #group-members
+ %h3= "#{t :members} (#{members.count})"
+ - members.each do |member|
+ %span.member
+ = link_to url_for(:controller => "users", :action => "profile", :username => "#{member.user.username}"), :method => :get, :remote => true, :class => 'get-user', :'data-type' => 'html', :id => "member_user_#{member.id}", :username => "#{member.user.username}" do
+ = image_tag member.user.image_url(:small).to_s, :width => 32, :height => 32, :class => "profile-picture-small", :title => "#{member.user.display_name}"
+ .clearfix
+
Oops, something went wrong.

0 comments on commit 79e1e58

Please sign in to comment.