diff --git a/Gemfile b/Gemfile index ae38608..1869f91 100644 --- a/Gemfile +++ b/Gemfile @@ -59,6 +59,7 @@ gem 'ask_geo' gem 'rabl' gem 'jquery-rails' gem 'haml-rails' +gem 'coffee-filter' gem 'simple_form' # Really Misc diff --git a/Gemfile.lock b/Gemfile.lock index 1bff1d2..8834a00 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -55,6 +55,9 @@ GEM ffi (~> 1.0.6) chunky_png (1.2.5) coderay (1.0.6) + coffee-filter (0.1.1) + coffee-script (>= 2.2.0) + haml (>= 3.0.18) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@ -299,6 +302,7 @@ DEPENDENCIES capybara capybara-webkit carrierwave + coffee-filter coffee-rails (~> 3.2.1) compass-h5bp compass-rails diff --git a/app/assets/.DS_Store b/app/assets/.DS_Store index 0d554e5..4846c31 100644 Binary files a/app/assets/.DS_Store and b/app/assets/.DS_Store differ diff --git a/app/assets/javascripts/backbone/routers/project_flow_router.js.coffee b/app/assets/javascripts/backbone/routers/project_flow_router.js.coffee index 17d2f43..a8850c3 100644 --- a/app/assets/javascripts/backbone/routers/project_flow_router.js.coffee +++ b/app/assets/javascripts/backbone/routers/project_flow_router.js.coffee @@ -1,6 +1,7 @@ class Ananta.Routers.ProjectFlowRouter extends Backbone.Router initialize: (options) -> - @projects = new Ananta.Collections.ProjectsCollection({}) + Ananta.App.currentUser = new Ananta.Models.User(options.currentUser) + @projects = new Ananta.Collections.ProjectsCollection() routes: ".*" : "index" diff --git a/app/assets/javascripts/backbone/views/project_flow/project_name_form.js.coffee b/app/assets/javascripts/backbone/views/project_flow/project_name_form.js.coffee index 921a2ad..bf513c2 100644 --- a/app/assets/javascripts/backbone/views/project_flow/project_name_form.js.coffee +++ b/app/assets/javascripts/backbone/views/project_flow/project_name_form.js.coffee @@ -10,12 +10,17 @@ class Ananta.Views.ProjectFlow.ProjectNameFormView extends Backbone.View initialize: (options) -> _.bindAll(@, 'render') + @model = new Ananta.Models.Project + @model.urlRoot = "/#{Ananta.App.currentUser.id}" render: -> $(@el).html(@template()) @ submit: (e) -> - @.trigger('removeProjectNameForm') e.preventDefault() e.stopPropagation() + @model.set('name', @$('input').val()) + @model.save() + @collection.add(@model) + @.trigger('removeProjectNameForm') diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 675eb67..dd14619 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -526,6 +526,10 @@ input{ border-bottom: 0; display: list-item; //TODO: wtf? } + .modal-body{ + padding-top: 0; + margin-top: -5px; + } .facebook{ p{ color: #bbb; @@ -619,6 +623,17 @@ input{ img { margin-bottom: 4px; } + .addthis_toolbox{ + display: inline-block; + vertical-align: top; + margin-top: 1px; + position: relative; + width: 125px; + height: 25px; + a{ + position: absolute; + } + } } } diff --git a/app/views/application/_footer.html.haml b/app/views/application/_footer.html.haml index 54e44a6..0ab9351 100644 --- a/app/views/application/_footer.html.haml +++ b/app/views/application/_footer.html.haml @@ -1,5 +1,37 @@ +=content_for :javascripts do + :coffeescript + $(() -> + buttons = $("#footer .addthis_toolbox").children() + pre = 99 + cur = 0 + hover = false + time = 3000 + $(buttons).fadeTo(0, 0.4); + $(buttons).hide() + transitionButtons = () => + cur = if (pre+1) < buttons.length then (pre+1) else 0 + $(buttons[pre]).fadeOut(500) + $(buttons[cur]).fadeIn(500) + pre = cur + recur = () => + if hover + wait time, () => recur() + else + transitionButtons() + wait time, () => recur() + transitionButtons() + # + $("#footer .addthis_toolbox").live + mouseenter: => + hover = true + $(buttons[cur]).fadeTo(300, 1.0); + mouseleave: => + hover = false + $(buttons[cur]).fadeTo(300, 0.4); + ) + .container - %p.center + .center ananta IO = image_tag "/assets/copyleft.png", style: "height: 10px" #{ Date.today.year } @@ -7,4 +39,9 @@ = link_to 'github', "https://github.com/ananta-io/ananta", target: "_blank" · = link_to 'about', '/about' - \ No newline at end of file + · + .addthis_toolbox.addthis_default_style + %a.addthis_button_facebook_like{"fb:like:layout" => "button_count"} + %a.addthis_button_tweet + %a.addthis_button_google_plusone{"g:plusone:size" => "medium"} + %script{:src => "http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4e07edfe1206c99f", :type => "text/javascript"} diff --git a/app/views/application/_head.html.haml b/app/views/application/_head.html.haml index 6b0555e..066b73c 100644 --- a/app/views/application/_head.html.haml +++ b/app/views/application/_head.html.haml @@ -1,3 +1,10 @@ +/ + a . --.-- .--. + n _|_ | : : + a .-. .--. .-. .--. | .-. | | | + t ( ) | |( ) | | | ( ) | : ; + a `-'`-' `-`-'`-' `-`-'`-'`- --'-- `--' + %meta{ charset: "utf-8" } -# Use the .htaccess and remove these lines to avoid edge case issues. @@ -7,7 +14,7 @@ %meta{ name: "viewport", content: "width=device-width, initial-scale=1.0" } %title - = yield :title || "#{ controller.controller_name.titleize } - #{ controller.action_name.titleize }" + = yield :title || "#{ controller.controller_name.titleize } - #{ controller.action_name.titleize }" %meta{ name: "description", content: "" } %meta{ name: "author", content: "" } diff --git a/app/views/pages/home.html.haml b/app/views/pages/home.html.haml index 9a5c3f5..c9bf625 100644 --- a/app/views/pages/home.html.haml +++ b/app/views/pages/home.html.haml @@ -4,7 +4,7 @@ :javascript $(function() { // Add project_flow to view - Ananta.router = new Ananta.Routers.ProjectFlowRouter(); + Ananta.router = new Ananta.Routers.ProjectFlowRouter({ 'currentUser' : #{render("users/base.json.rabl", object: current_user)} }); Backbone.history.start(); }); diff --git a/app/views/users/_base.json.rabl b/app/views/users/_base.json.rabl new file mode 100644 index 0000000..5f728ce --- /dev/null +++ b/app/views/users/_base.json.rabl @@ -0,0 +1,7 @@ +object @user + +attributes :id, :username + +node(:avatar) do |user| + user.profile.avatar.image.small if user +end \ No newline at end of file diff --git a/app/views/users/index.json.rabl b/app/views/users/index.json.rabl index b04377f..4d811f5 100644 --- a/app/views/users/index.json.rabl +++ b/app/views/users/index.json.rabl @@ -1 +1,3 @@ -extends 'users/show' \ No newline at end of file +collection @users + +extends 'users/base' \ No newline at end of file diff --git a/app/views/users/show.json.rabl b/app/views/users/show.json.rabl index 0aa1dd0..48b3c8b 100644 --- a/app/views/users/show.json.rabl +++ b/app/views/users/show.json.rabl @@ -1,7 +1,3 @@ object @user -attributes :id, :username - -node(:avatar) do |user| - user.profile.avatar.image.small -end \ No newline at end of file +extends 'users/base' \ No newline at end of file