fix activity feed filters; small refactoring

This commit is contained in:
Alexander Machehin 2015-05-13 20:58:54 +05:00
parent e5d3985ff7
commit f04b2ef070
7 changed files with 33 additions and 11 deletions

View File

@ -12,10 +12,20 @@ ActivityController = ($scope, $http, $timeout, $q, $filter, $location, ActivityF
prev_date = cur_date
)
$scope.$watch (->
vm.current_activity_tab.owner_uname_filter_tmp
), () ->
vm.selectOwnerFilter({uname: null}, null, null) unless vm.current_activity_tab.owner_uname_filter_tmp
$scope.$watch (->
vm.current_activity_tab.project_name_filter_tmp
), () ->
vm.selectProjectNameFilter({name: null}, null, null) unless vm.current_activity_tab.project_name_filter_tmp
vm = this
vm.processing = false
vm.activity_tab =
filter: 'all'
all: {}
@ -138,6 +148,7 @@ ActivityController = ($scope, $http, $timeout, $q, $filter, $location, ActivityF
vm.getActivityContent()
vm.getActivityContent = ()->
vm.processing = true
options =
filter: vm.current_activity_tab.filter
owner_filter: vm.current_activity_tab.owner_filter
@ -154,6 +165,7 @@ ActivityController = ($scope, $http, $timeout, $q, $filter, $location, ActivityF
vm.getCurActivity().feed = feed
vm.getCurActivity().next_page_link = res.data.next_page_link
calculateChangeDate(feed)
vm.processing = false
true
vm.setIssuesFilter = (kind, issues_filter)->
@ -240,7 +252,6 @@ ActivityController = ($scope, $http, $timeout, $q, $filter, $location, ActivityF
vm.getActivityContent()
true
angular
.module("RosaABF")
.controller "ActivityController", ActivityController

View File

@ -0,0 +1,4 @@
- size = Avatar::AVATAR_SIZES[:small]
a
img ng-src= "{{match.model.avatar_path}}" height= size width= size
span< bind-html-unsafe= "match.model.uname | typeaheadHighlight:query"

View File

@ -85,8 +85,8 @@ class HomeController < ApplicationController
def get_owners_list
if params[:term].present?
users = User.opened.search(params[:term]).pluck(:uname).first(5)
groups = Group.opened.search(params[:term]).pluck(:uname).first(5)
users = User.opened.search(params[:term]).first(5)
groups = Group.opened.search(params[:term]).first(5)
@owners = users | groups
end

View File

@ -8,4 +8,6 @@ tab[ heading= t('activity_menu.activity_feed')
= t 'layout.activity_feed.header'
= link_to image_tag('rss.ico', width: '15px', height: '15px', class: 'atom_icon'),
atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token)
i< class= 'fa fa-spinner fa-spin fa-lg offset10 boffset10' ng-show= 'actCtrl.processing'
== render 'activity_tabsets'

View File

@ -2,13 +2,16 @@ hr
h4
=> t('layout.relations.filters')
strong.text-danger= t 'new_feature'
.form-group
= text_field_tag :owner_uname, nil,
class: 'form-control',
placeholder: t('search.placeholders.owner_filter'),
'ng-model' => 'actCtrl.current_activity_tab.owner_uname_filter_tmp',
'typeahead' => 'owner.uname for owner in actCtrl.getOwnersList($viewValue)',
'typeahead-on-select' => 'actCtrl.selectOwnerFilter($item, $model, $label)'
class: 'form-control',
placeholder: t('search.placeholders.owner_filter'),
'ng-model' => 'actCtrl.current_activity_tab.owner_uname_filter_tmp',
'typeahead' => 'owner.uname for owner in actCtrl.getOwnersList($viewValue)',
'typeahead-on-select' => 'actCtrl.selectOwnerFilter($item, $model, $label)',
'typeahead-template-url' => "get_owners.html"
.form-group
= text_field_tag :project_name, nil,
class: 'form-control',

View File

@ -8,4 +8,5 @@ tab[ active= "actCtrl.own_activity_tab.active"
.col-md-9.offset10
h3
= t 'layout.activity_feed.own_header'
i< class= 'fa fa-spinner fa-spin fa-lg offset10 boffset10' ng-show= 'actCtrl.processing'
== render 'activity_tabsets'

View File

@ -1,3 +1,4 @@
json.array!(@owners) do |uname|
json.uname uname
json.array!(@owners) do |owner|
json.avatar_path avatar_url(owner)
json.uname owner.uname
end