tawork 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTA4NTIwMzUwMDhhNzQyMzQ1MjViNzFhNzFlYjU1ZTQwZDFhMzI0Yg==
4
+ M2RjYWIzYTExZmMwMTM4YjYzMWNiZTNhZTMxNWM4MjRhMmZmNDJjOA==
5
5
  data.tar.gz: !binary |-
6
- YWFlZWM0M2FlZDBkODE5OGExYmVkYjU4YzA1ZmE1Yjg1YjcxZDIwMg==
6
+ OTQ4ODZiNWFlN2I3MDMxMjJmZWUwOGUyMDJhNzdiYTUzZDNjN2IzMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTE3YWYxNjYxYjcxZDU2OTFkMWE3NTFhNTU5YzFhYzZkOTY0YTZjNGY5OTQw
10
- M2Q5NTMxNGU4Mzg3MmY3ODBhNTZkNzYxODZhNWQzYzJmMTlhNTE4Mzk0OTc3
11
- ODllZTdjZjA5ZTNjMTgwNzJlYWEyODJmYWU4Y2Y3ZDVhMTg0MmQ=
9
+ Mzk2NmU0MzdmMzJhMzk0NGUxODBlMTgyYmNlYTUwZDQ0ZGI4YWVjZjE2MzNk
10
+ MWM1MjJiN2ViYjNhZDNkMWNmYjMyNDRjZDIwZTllMTcyYTUyNmViOTdlM2Qz
11
+ ZmU0OGE5NDIyYzI5OGYwYzhlOTg4ZWNmNzBkMWRiNDI1YWMzZDQ=
12
12
  data.tar.gz: !binary |-
13
- ZmM0ODg1NmIzNmI0MmFhYWVjOWU2MGE0YzdjMDY5MTI5OWY5YTM1ZjZhODBj
14
- Zjk0MzU3ZjllMTIwZTlkM2IyZTcwOTA4ZTIwZmQ4ZjZkZDFkNjg1ZTk4MTJh
15
- YTdhNTgwNDJkZjdhNDVlNTkwMGU1OWE4MmY5NzJhYjE4OThmNDI=
13
+ OGUzOTEzYzU2MjJjMGIyZWRhZDc0YzRjZGY5YmJhNGY1ODIzYTRiMzk3NTE0
14
+ N2M5M2NlNTBmYWRiZjI5YmRhNTEzMjZlMDUzYTczODgxYmRiMzFlN2E4MWRm
15
+ NGRhZjQyZjBiMGU4YTg5YThhODczODVhNTkxYjk1ZmE2ODg2ZGY=
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  # Ignore all logfiles and tempfiles.
15
15
  /log/*.log
16
16
  /tmp
17
+ tawork.git
@@ -1,5 +1,6 @@
1
1
  class Tawork.Views.PageView extends Backbone.View
2
- events: {}
2
+ events:
3
+ 'click a.star': 'starred'
3
4
 
4
5
  initialize: (options = {}) ->
5
6
  @page_id = @$el.data("page-id")
@@ -72,5 +73,32 @@ class Tawork.Views.PageView extends Backbone.View
72
73
  )
73
74
 
74
75
  uploader.init()
75
-
76
+
77
+ starred: (event) ->
78
+ $star = $(event.target).closest("a.star")
79
+ $icon = $star.find("i.fa")
80
+ $.blockUI(message: "")
81
+
82
+ if $icon.hasClass("fa-star-o")
83
+ star = true
84
+ else
85
+ star = false
86
+
87
+ $.ajax
88
+ type: $star.data("type")
89
+ url: $star.data("url")
90
+ data:
91
+ to_star: star
92
+ success: (data) ->
93
+ if $icon.hasClass("fa-star-o")
94
+ $icon.removeClass("fa-star-o")
95
+ $icon.addClass("fa-star")
96
+ else
97
+ $icon.removeClass("fa-star")
98
+ $icon.addClass("fa-star-o")
99
+ complete: ->
100
+ $.unblockUI()
101
+
102
+
103
+ false
76
104
 
@@ -2,6 +2,6 @@ class HomeController < ApplicationController
2
2
  before_filter :authenticate_user!
3
3
 
4
4
  def index
5
- @activities = PublicActivity::Activity.limit(15)
5
+ @activities = PublicActivity::Activity.limit(15).order("created_at desc")
6
6
  end
7
7
  end
@@ -92,6 +92,19 @@ class Wiki::PagesController < ApplicationController
92
92
  render partial: 'subpages_dropdown'
93
93
  end
94
94
 
95
+ def star
96
+ starred = Starred.where(user_id: current_user.id, starrable_id: @page, starrable_type: @page.class).first
97
+
98
+ if starred && params[:to_star] == "false"
99
+ starred.destroy
100
+ end
101
+
102
+ if !starred && params[:to_star] == "true"
103
+ Starred.create(user: current_user, starrable: @page)
104
+ end
105
+ render json: {}
106
+ end
107
+
95
108
  protected
96
109
  def load_page
97
110
  @page = Page.find(params[:id]) if params[:id]
@@ -0,0 +1,4 @@
1
+ class Starred < ActiveRecord::Base
2
+ belongs_to :user
3
+ belongs_to :starrable, polymorphic: true
4
+ end
data/app/models/user.rb CHANGED
@@ -35,4 +35,9 @@ class User < ActiveRecord::Base
35
35
  def display_name
36
36
  name || username || email
37
37
  end
38
+
39
+ def starred?(starrable)
40
+ starred = Starred.where(user: self, starrable: starrable).first
41
+ starred.present?
42
+ end
38
43
  end
@@ -1,4 +1,14 @@
1
- %h2 Oh, hello there!
1
+ .col-md-9
2
+ %h3 Recent Changes
3
+ %table.table
4
+ - @activities.each do |activity|
5
+ %tr
6
+ %td
7
+ = activity.render(self, layout: :activity_wrapper)
2
8
 
3
- %h3 Latest Activity
4
- %p Coming soon!
9
+ .col-md-3
10
+ %h3 Starred Pages
11
+ %ul.list-unstyled
12
+ - Starred.where(user: current_user, starrable_type: 'Page').each do |starred|
13
+ %li
14
+ = link_to starred.starrable.title, wiki_page_path(starred.starrable)
@@ -3,6 +3,8 @@
3
3
  = link_to wiki_pages_path, class: "space-link" do
4
4
  All Spaces
5
5
  %i.fa.fa-arrow-circle-right
6
+ %li.divider
7
+
6
8
  - if @space.present? && @space.persisted?
7
9
  %li.nav-header
8
10
  = @space.title
@@ -13,9 +15,12 @@
13
15
  -# - if page.has_children?
14
16
  -# %i.fa.fa-plus-square
15
17
  -# = page.title
16
- %li
17
- = link_to new_wiki_space_path do
18
- %i.fa.fa-plus
18
+ - else
19
+ - Page.roots.each do |page|
20
+ = render 'wiki/spaces/page_list_item', page: page, end_page: @page
21
+ -# %li
22
+ -# = link_to new_wiki_space_path do
23
+ -# %i.fa.fa-plus
19
24
 
20
25
  :coffeescript
21
26
  $ ->
@@ -0,0 +1,4 @@
1
+ - content_for :action, flush: true do
2
+ added attachment to page #{link_to activity.trackable.title, wiki_page_path(activity.trackable)}
3
+
4
+
@@ -0,0 +1,4 @@
1
+ - content_for :action, flush: true do
2
+ created page #{link_to activity.trackable.title, wiki_page_path(activity.trackable)}
3
+
4
+
@@ -0,0 +1,2 @@
1
+ - content_for :action, flush: true do
2
+ reordered the page: #{link_to activity.trackable.title, wiki_page_path(activity.trackable)}
@@ -0,0 +1,4 @@
1
+ - content_for :action, flush: true do
2
+ updated page #{link_to activity.trackable.title, wiki_page_path(activity.trackable)}
3
+
4
+
@@ -3,4 +3,4 @@
3
3
  %span Last updated by
4
4
  .user= @last_updated.owner.display_name
5
5
  \-
6
- .time{data: {timestamp: @last_updated.created_at}}= timeago_tag @last_updated.created_at, date_only: false
6
+ .time{data: {timestamp: @last_updated.created_at}}= timeago_tag @last_updated.created_at, date_only: false, format: :casual
@@ -2,6 +2,13 @@
2
2
  %li
3
3
  %a.edit{href: "#", data: {toggle: "tooltip", placement: "top"}, title: "Edit"}
4
4
  %i.fa.fa-edit
5
+
6
+ %li
7
+ %a.star{href: "#", data: {type: "POST", url: star_wiki_page_path(@page), toggle: "tooltip", placement: "top"}, title: "Star"}
8
+ - if current_user.starred?(@page)
9
+ %i.fa.fa-star
10
+ - else
11
+ %i.fa.fa-star-o
5
12
  %li
6
13
  %a.save{href: "#", data: {type: "PUT", url: wiki_page_path(@page), toggle: "tooltip", placement: "top"}, title: "Save", style: "display: none;"}
7
14
  %i.fa.fa-save
@@ -1,16 +1,24 @@
1
- %h3 Wiki Sitemap (Two levels)
1
+ .col-md-9
2
+ %h3 Wiki Sitemap (Two levels)
2
3
 
3
- %ul.nav.nav-list
4
- - @roots.each do |node|
5
- %li
6
- = link_to node.title, wiki_page_path(node), class: "space-link"
4
+ = link_to "New Space", new_wiki_space_path, class: "btn btn-primary"
7
5
 
8
- %ul.nav-list-sub
9
- - node.children.each do |child|
10
- %li
11
- = link_to wiki_page_path(child) do
12
- = child.title
13
- - if child.has_children?
14
- %i.fa.fa-arrow-circle-right
6
+ %ul.nav.nav-list
7
+ - @roots.each do |node|
8
+ %li
9
+ = link_to node.title, wiki_page_path(node), class: "space-link"
15
10
 
11
+ %ul.nav-list-sub
12
+ - node.children.each do |child|
13
+ %li
14
+ = link_to wiki_page_path(child) do
15
+ = child.title
16
+ - if child.has_children?
17
+ %i.fa.fa-arrow-circle-right
16
18
 
19
+ .col-md-3
20
+ %h3 Starred Pages
21
+ %ul.list-unstyled
22
+ - Starred.where(user: current_user, starrable_type: 'Page').each do |starred|
23
+ %li
24
+ = link_to starred.starrable.title, wiki_page_path(starred.starrable)
@@ -1,4 +1,4 @@
1
1
  config_file = File.join(Rails.root, "config", "tawork.yml")
2
2
  TAWORK_CONFIG = File.exist?(config_file) ? YAML.load_file(config_file) : {}
3
3
 
4
- TAWORK_CONFIG["git_repo_path"] ||= "./tmp/tawork.git"
4
+ TAWORK_CONFIG["git_repo_path"] ||= "./tawork.git"
@@ -21,3 +21,6 @@
21
21
 
22
22
  en:
23
23
  hello: "Hello world"
24
+ time:
25
+ formats:
26
+ casual: "%B %e, %Y at %l:%M%p"
data/config/routes.rb CHANGED
@@ -4,7 +4,7 @@ Rails.application.class.routes.draw do
4
4
  devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
5
5
  end
6
6
 
7
- root 'wiki/pages#index'
7
+ root 'home#index'
8
8
  get 'sink/index' #=> "sink#index"
9
9
  get 'sink/components' #=> "sink#components"
10
10
 
@@ -22,6 +22,7 @@ Rails.application.class.routes.draw do
22
22
  get :combined
23
23
  get :history
24
24
  post :reorder
25
+ post :star
25
26
 
26
27
  post :attach
27
28
  end
@@ -0,0 +1,10 @@
1
+ class CreateStarreds < ActiveRecord::Migration
2
+ def change
3
+ create_table :starreds do |t|
4
+ t.references :starrable, polymorphic: true
5
+ t.references :user, index: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
data/db/schema.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20140120030547) do
14
+ ActiveRecord::Schema.define(version: 20140313052226) do
15
15
 
16
16
  create_table "activities", force: true do |t|
17
17
  t.integer "trackable_id"
@@ -77,6 +77,16 @@ ActiveRecord::Schema.define(version: 20140120030547) do
77
77
 
78
78
  add_index "pages", ["creator_id"], name: "index_pages_on_creator_id", using: :btree
79
79
 
80
+ create_table "starreds", force: true do |t|
81
+ t.integer "starrable_id"
82
+ t.string "starrable_type"
83
+ t.integer "user_id"
84
+ t.datetime "created_at"
85
+ t.datetime "updated_at"
86
+ end
87
+
88
+ add_index "starreds", ["user_id"], name: "index_starreds_on_user_id", using: :btree
89
+
80
90
  create_table "story_details", force: true do |t|
81
91
  t.integer "ticket_id"
82
92
  t.string "who"
@@ -1,3 +1,3 @@
1
1
  module Tawork
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.12'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tawork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adnan Ali
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-07 00:00:00.000000000 Z
11
+ date: 2014-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,6 +86,7 @@ files:
86
86
  - app/models/page.rb
87
87
  - app/models/project.rb
88
88
  - app/models/space.rb
89
+ - app/models/starred.rb
89
90
  - app/models/story.rb
90
91
  - app/models/story_detail.rb
91
92
  - app/models/task.rb
@@ -115,6 +116,10 @@ files:
115
116
  - app/views/layouts/minimal.html.haml
116
117
  - app/views/projects/index.html.haml
117
118
  - app/views/projects/new.html.haml
119
+ - app/views/public_activity/page/_attachment.html.haml
120
+ - app/views/public_activity/page/_created.html.haml
121
+ - app/views/public_activity/page/_reorder.html.haml
122
+ - app/views/public_activity/page/_update_details.html.haml
118
123
  - app/views/public_activity/ticket/_assignment.html.haml
119
124
  - app/views/public_activity/ticket/_create_comment.html.haml
120
125
  - app/views/public_activity/ticket/_created.html.haml
@@ -206,6 +211,7 @@ files:
206
211
  - db/migrate/20140109235844_create_pages.rb
207
212
  - db/migrate/20140112004346_create_attachments.rb
208
213
  - db/migrate/20140120030547_add_name_to_users.rb
214
+ - db/migrate/20140313052226_create_starreds.rb
209
215
  - db/schema.rb
210
216
  - db/seeds.rb
211
217
  - init.rb
@@ -298,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
304
  version: '0'
299
305
  requirements: []
300
306
  rubyforge_project:
301
- rubygems_version: 2.1.11
307
+ rubygems_version: 2.2.2
302
308
  signing_key:
303
309
  specification_version: 4
304
310
  summary: Wiki and Tickets