From 41c26ea7360da88e2d795321fe219e2bb809e663 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Thu, 4 Feb 2016 14:28:27 +0100 Subject: [PATCH] channels/twitter style search terms --- .../app/controllers/_channel/twitter.coffee | 56 +++++++++++------- .../views/calendar/holiday_selector.jst.eco | 26 ++++---- .../holiday_selector_placeholder.jst.eco | 8 +-- .../app/views/channel/topics.jst.eco | 8 +-- .../app/views/twitter/account_edit.jst.eco | 48 ++++++++------- .../app/views/twitter/search_term.jst.eco | 7 +++ app/assets/stylesheets/zammad.scss | 36 ++++++----- .../Contents/Resources/Scripts/main.scpt | Bin 5214 -> 5192 bytes 8 files changed, 107 insertions(+), 82 deletions(-) create mode 100644 app/assets/javascripts/app/views/twitter/search_term.jst.eco diff --git a/app/assets/javascripts/app/controllers/_channel/twitter.coffee b/app/assets/javascripts/app/controllers/_channel/twitter.coffee index 7ef166c88..4b64b3957 100644 --- a/app/assets/javascripts/app/controllers/_channel/twitter.coffee +++ b/app/assets/javascripts/app/controllers/_channel/twitter.coffee @@ -121,8 +121,8 @@ class Index extends App.ControllerContent channel = App.Channel.find(id) content = $( App.view('twitter/account_edit')(channel: channel) ) - groupSelection = (selected_id, el, prefix) -> - selection = App.UiElement.select.render( + createGroupSelection = (selected_id, prefix) -> + return App.UiElement.select.render( name: "#{prefix}::group_id" multiple: false limit: 100 @@ -130,30 +130,46 @@ class Index extends App.ControllerContent relation: 'Group' nulloption: true default: selected_id + class: 'form-control--small' ) - el.find('.js-groups').html(selection) - placeholderAdd = (value = '', group_id) -> - placeholder = content.find('.js-searchTermPlaceholder').clone() - placeholder.removeClass('hidden').removeClass('js-searchTermPlaceholder') - placeholder.find('input').val(value) - placeholder.find('input').attr('name', 'search::term') - groupSelection(group_id, placeholder, 'search') - content.find('.js-searchTermList').append(placeholder) + addSearchTerm = () => + @searchTerms.push + term: "" + group_id: "" + renderSearchTerms() + content.find('.js-searchTermList [name="search::term"]').last().focus() + + removeSearchTerm = (event) => + index = $(event.currentTarget).attr('data-index') + @searchTerms.splice(index, 1) + renderSearchTerms() + + renderSearchTerms = () => + return if !@searchTerms + + content.find('.js-searchTermList').empty() + + for item, i in @searchTerms + content.find('.js-searchTermList').append App.view('twitter/search_term') + term: item.term + index: i + + select = createGroupSelection(item.group_id, 'search') + content.find(".js-termGroup[data-index=\"#{i}\"]").replaceWith select if channel.options && channel.options.sync && channel.options.sync.search - for item in channel.options.sync.search - placeholderAdd(item.term, item.group_id, 'search') + @searchTerms = channel.options.sync.search + else + @searchTerms = [] - content.find('.js-searchTermAdd').on('click', -> - placeholderAdd('', '') - ) - content.find('.js-searchTerm').on('click', '.js-searchTermRemove',(e) -> - $(e.target).closest('.js-searchTermItem').remove() - ) + renderSearchTerms() - groupSelection(channel.options.sync.mentions.group_id, content.find('.js-mention'), 'mentions') - groupSelection(channel.options.sync.direct_messages.group_id, content.find('.js-directMessage'), 'direct_messages') + content.find('.js-searchTermAdd').click(addSearchTerm) + content.find('.js-searchTermList').on('click', '.js-searchTermRemove', removeSearchTerm) + + content.find('.js-mentionsGroup').replaceWith createGroupSelection(channel.options.sync.mentions.group_id, 'mentions') + content.find('.js-directMessagesGroup').replaceWith createGroupSelection(channel.options.sync.direct_messages.group_id, 'direct_messages') modal = new App.ControllerModal( head: 'Twitter Account' diff --git a/app/assets/javascripts/app/views/calendar/holiday_selector.jst.eco b/app/assets/javascripts/app/views/calendar/holiday_selector.jst.eco index cdf896e14..dfc95ef68 100644 --- a/app/assets/javascripts/app/views/calendar/holiday_selector.jst.eco +++ b/app/assets/javascripts/app/views/calendar/holiday_selector.jst.eco @@ -16,27 +16,25 @@ <%- @Icon('checkbox-checked', 'icon-checked') %> <%- @Tdate(day) %> - - -
- <% if !meta.feed: %> -
- <%- @Icon('trash') %> <%- @T('Remove') %> -
- <% end %> -
+ + + <% if !meta.feed: %> +
+ <%- @Icon('trash') %> <%- @T('Remove') %> +
+ <% end %> <% end %> - + - + - + - -
+ +
<%- @Icon('plus-small') %> <%- @T('Add') %>
diff --git a/app/assets/javascripts/app/views/calendar/holiday_selector_placeholder.jst.eco b/app/assets/javascripts/app/views/calendar/holiday_selector_placeholder.jst.eco index eddce6e5f..85a1f7f6c 100644 --- a/app/assets/javascripts/app/views/calendar/holiday_selector_placeholder.jst.eco +++ b/app/assets/javascripts/app/views/calendar/holiday_selector_placeholder.jst.eco @@ -7,9 +7,7 @@ <%- @Tdate(@placeholderDate) %> - -
-
- <%- @Icon('trash') %> <%- @T('Remove') %> -
+ +
+ <%- @Icon('trash') %> <%- @T('Remove') %>
\ No newline at end of file diff --git a/app/assets/javascripts/app/views/channel/topics.jst.eco b/app/assets/javascripts/app/views/channel/topics.jst.eco index 578a58b84..98fea1eaf 100644 --- a/app/assets/javascripts/app/views/channel/topics.jst.eco +++ b/app/assets/javascripts/app/views/channel/topics.jst.eco @@ -27,11 +27,9 @@ - -
-
- <%- @Icon('trash') %> <%- @T('Remove') %> -
+ +
+ <%- @Icon('trash') %> <%- @T('Remove') %>
<% end %> diff --git a/app/assets/javascripts/app/views/twitter/account_edit.jst.eco b/app/assets/javascripts/app/views/twitter/account_edit.jst.eco index 21cdd0ac9..4c310fd79 100644 --- a/app/assets/javascripts/app/views/twitter/account_edit.jst.eco +++ b/app/assets/javascripts/app/views/twitter/account_edit.jst.eco @@ -3,30 +3,32 @@

<%- @T('Search Terms') %>

<%- @T('Tweets containing search terms are automatically turned into tickets.') %>

-
- -
-
- <%- @Icon('plus-small') %> <%- @T('Add') %> -
-
-
-

<%- @T('Mentions Group') %>

-

<%- @T('Choose which group %s will get added to.', 'mentions') %>

-
-
+ + + + + + + + + + +
<%- @T('Search Term') %> + <%- @T('Group') %> + <%- @T('Action') %> +
+ <%- @T('Empty') %> +
+ <%- @Icon('plus-small') %> +
+ +

<%- @T('Mentions Group') %>

+

<%- @T('Choose which group %s will get added to.', 'mentions') %>

+
-
-

<%- @T('Direct Messages Group') %>

-

<%- @T('Choose which group %s will get added to.', 'direct messages') %>

-
-
+

<%- @T('Direct Messages Group') %>

+

<%- @T('Choose which group %s will get added to.', 'direct messages') %>

+
\ No newline at end of file diff --git a/app/assets/javascripts/app/views/twitter/search_term.jst.eco b/app/assets/javascripts/app/views/twitter/search_term.jst.eco new file mode 100644 index 000000000..2f131b4f2 --- /dev/null +++ b/app/assets/javascripts/app/views/twitter/search_term.jst.eco @@ -0,0 +1,7 @@ + + +
+ +
+ <%- @Icon('trash') %> <%- @T('Remove') %> +
\ No newline at end of file diff --git a/app/assets/stylesheets/zammad.scss b/app/assets/stylesheets/zammad.scss index 1235f41c2..0d612a31a 100644 --- a/app/assets/stylesheets/zammad.scss +++ b/app/assets/stylesheets/zammad.scss @@ -317,7 +317,7 @@ pre code.hljs { .icon { vertical-align: middle; - margin-top: -1px; // more negative margin top looks bad on the btn--quad plus in overviews + margin-top: -3px; } &.btn--icon--last .icon { @@ -424,6 +424,7 @@ pre code.hljs { } &.btn--positive, + &.btn--create, &.btn--success { color: white; background: hsl(145,51%,45%); @@ -441,6 +442,10 @@ pre code.hljs { } } + &.btn--text { + color: $supergood-color; + } + .icon { fill: white; } @@ -521,6 +526,10 @@ pre code.hljs { &.btn--quad { padding: 10px 12px 9px; + + .icon { + margin-top: -1px; + } } &.btn--split--first { @@ -6808,20 +6817,13 @@ output { margin: 0; } - .btn.btn--text:not(.btn--secondary) { - color: hsl(60,1%,61%); - } - - .btn .icon { - fill: hsl(60,1%,61%); - } - th:not(:last-child), td:not(:last-child) { border-right: none; } - tr:not(:last-child) td { + tr:not(:last-child) td, + & > tbody:not(:last-child) tr td { border-bottom: none; } @@ -6838,11 +6840,13 @@ output { border-top-right-radius: 4px; } - & > tbody > tr:last-child > td:first-child { + & > tbody:last-child > tr:last-child > td:first-child, + & > tfoot:last-child > tr:last-child > td:first-child { border-bottom-left-radius: 4px; } - & > tbody > tr:last-child > td:last-child { + & > tbody:last-child > tr:last-child > td:last-child, + & > tfoot:last-child > tr:last-child > td:last-child { border-bottom-right-radius: 4px; } @@ -6870,9 +6874,11 @@ output { } } - .settings-list-controlRow { - td { - padding: 5px; + .settings-list-control-cell { + padding: 5px; + + & ~ .settings-list-row-control { + padding-bottom: 7px; } } } diff --git a/contrib/mac_developer_scripts.app/Contents/Resources/Scripts/main.scpt b/contrib/mac_developer_scripts.app/Contents/Resources/Scripts/main.scpt index 343ced05ce9dd5f9cf7ce0205d343503a2044037..03f871f6ec9cc8219fb8d0c2b418ad4da9733851 100644 GIT binary patch delta 512 zcmcboaYAE55;M~&j>#MOyeBs>vrpc}ENGI$z{J4F>5-a~o}ZJLm%@MnF3nyV;h_x{ zw%~Hh%u7ivnrzQ+!O6hDv}nntbW_R6b^P*^W4J~1W>5D3DidVjU|_hEt`1bdz{tP@ zBrSm09Ei<;RvE)>n!JEpVe)@P6|xIsu)A)vC{I5V(;=AixF`SNJb}3+fDA0L^TF8MH&}<5J8ZaPN_XAnsK$G(B!0h6~d3tJR1FflN42j}NxrYHoLOMKsofNVwv9*`y= z&I000phc!g_Dr73;vp%)z|9cMkk63Akjaq3pa5i-0C{-~shfYXB(pNT0lU+IfuT6H zteAm`ks&cBvlwVH17ja4&Yt|9%aOgAebL2#|GuKT_2R!rSFyU)2Gy+!lXr02$l`P_ zgAjx6BgznV3#M!nc8$ZSn^`UfnFB9osN}-efI)NA`x7A20s<>;!bIyd7s~ zNoG!FNoFe0=K|p1MGESR|E?>6ozKAl)C&yeE}&h8$WA}Yk1v?D1eP+3XJLpF