Support for ChatOps Coloring

pull/1077/head
Lee Faus 10 years ago
parent d716021dcc
commit fdfc3b03d7
  1. 3
      client/stylesheets/base.less
  2. 27
      client/stylesheets/utils/_chatops.less
  3. 22
      client/views/app/message.coffee
  4. 2
      client/views/app/message.html
  5. 9
      client/views/app/room.html
  6. 4
      client/views/app/sideNav/chatRoomItem.html
  7. 1
      packages/rocketchat-chatops/server/settings.coffee
  8. 8
      packages/rocketchat-github-enterprise/startup.coffee
  9. 2
      packages/rocketchat-lib/settings/server/startup.coffee
  10. 1
      packages/rocketchat-mentions/client.coffee

@ -6,6 +6,7 @@
@import "utils/_emojione.import.less";
@import "utils/_fonts.import.less";
@import "utils/_octicons.less";
@import "utils/_chatops.less";
.clearfix {
clear: both;
&::after {
@ -2346,7 +2347,7 @@ a.github-fork {
.message {
font-size: 14px;
padding: 18px 20px 4px 70px;
padding: 5px 20px 5px 70px;
position: relative;
line-height: 20px;
min-height: 40px;

@ -0,0 +1,27 @@
li.chatops-message {
background-color: #f8f8f8;
}
.message .thumb .avatar {
margin-top: -15px !important;
}
.chatops-message div.body {
font-size: 12px;
font-weight: bold;
color: #7a7a7a;
}
li.chatops-message.sequential {
margin-top: -5px !important;
}
.octicon.file {
font: normal normal normal 24px/1 octicons;
}
.github-tagline {
padding-top: 3px;
font-weight: 200;
color: white;
}

@ -5,6 +5,9 @@ Template.message.helpers
own: ->
return 'own' if this.u?._id is Meteor.userId()
chatops: ->
return 'chatops-message' if this.u?.username is RocketChat.settings.get('Chatops_Username')
time: ->
return moment(this.ts).format('HH:mm')
@ -28,10 +31,16 @@ Template.message.helpers
when 'rm' then t('Message_removed', { user: this.u.username })
when 'rtc' then RocketChat.callbacks.run 'renderRtcMessage', this
else
if this.u?.username is RocketChat.settings.get('Chatops_Username')
this.html = this.msg
message = RocketChat.callbacks.run 'renderMentions', this
# console.log JSON.stringify message
return this.html
this.html = this.msg
if _.trim(this.html) isnt ''
this.html = _.escapeHTML this.html
message = RocketChat.callbacks.run 'renderMessage', this
# console.log JSON.stringify message
this.html = message.html.replace /\n/gm, '<br/>'
return this.html
@ -89,12 +98,13 @@ Template.message.onViewRendered = (context) ->
ul = lastNode.parentElement
wrapper = ul.parentElement
if context.urls?.length > 0 and Template.oembedBaseWidget? and RocketChat.settings.get 'API_Embed'
for item in context.urls
do (item) ->
urlNode = lastNode.querySelector('.body a[href="'+item.url+'"]')
if urlNode?
$(lastNode.querySelector('.body')).append Blaze.toHTMLWithData Template.oembedBaseWidget, item
if this.u?.username is not "hubot"
if context.urls?.length > 0 and Template.oembedBaseWidget? and RocketChat.settings.get 'API_Embed'
for item in context.urls
do (item) ->
urlNode = lastNode.querySelector('.body a[href="'+item.url+'"]')
if urlNode?
$(lastNode.querySelector('.body')).append Blaze.toHTMLWithData Template.oembedBaseWidget, item
if not lastNode.nextElementSibling?
if lastNode.classList.contains('own') is true

@ -1,5 +1,5 @@
<template name="message">
<li id="{{_id}}" class="message sequential {{system}} {{t}} {{own}} {{isTemp}}" data-username="{{u.username}}" data-date="{{date}}">
<li id="{{_id}}" class="message sequential {{system}} {{t}} {{own}} {{isTemp}} {{chatops}}" data-username="{{u.username}}" data-date="{{date}}">
<a class="thumb user-card-message" href="#" data-username="{{u.username}}" tabindex="1">{{> avatar username=u.username}}</a>
<a class="user user-card-message" href="#" data-username="{{u.username}}" tabindex="1">{{u.username}}</a>
<span class="info">

@ -80,14 +80,15 @@
<form class="message-form" method="post" action="/">
<div style="display: flex">
<div class="file">
<i class="icon-attach"></i>
<i class="octicon octicon-cloud-upload file"></i>
<input type="file" accept="image/*">
</div>
<div class="input-message-container">
{{> messagePopupConfig getPupupConfig}}
<textarea dir="auto" name="msg" maxlength="{{maxMessageLength}}" class="input-message autogrow-short" placeholder="{{_ 'Message'}}"></textarea>
<i class="icon-paper-plane" title="{{_ "Send_Message"}}" aria-label="{{_ "Send_Message"}}"></i>
<!--<i class="icon-paper-plane" title="{{_ "Send_Message"}}" aria-label="{{_ "Send_Message"}}"></i>-->
</div>
<!--
{{#if canRecordAudio}}
<div class="mic">
<i class="icon-mic" aria-label="{{_ "Record"}}"></i>
@ -96,6 +97,7 @@
<i class="icon-stop" aria-label="{{_ "Stop_Recording"}}"></i>
</div>
{{/if}}
-->
</div>
<div class="users-typing">
{{#with usersTyping}}
@ -115,6 +117,7 @@
{{/if}}
{{/with}}
</div>
<!--
{{#if showFormattingTips}}
<div class="formatting-tips" aria-hidden="true" dir="auto">
{{#if showMarkdown}}
@ -129,8 +132,10 @@
{{#if showMarkdown}}
<q><span class="hidden-br"><br></span>&gt;{{_ "quote"}}</q>
{{/if}}
</div>
{{/if}}
-->
<div class="editing-commands" aria-hidden="true" dir="auto">
<div class="editing-commands-cancel">{{_ 'Esc_to'}} <a href="">{{_ 'Cancel'}}</a></div>
<div class="editing-commands-save">{{_ 'Enter_to'}} <a href="">{{_ 'Save_changes'}}</a></div>

@ -7,9 +7,9 @@
<i class="{{roomIcon}} {{userStatus}}"></i>
<span class='name'>{{name}}</span>
<span class='opt'>
<i class="icon-cancel-circled hide-room" title="{{_ "Hide_room"}}"></i>
<i class="octicon octicon-eye hide-room" title="{{_ "Hide_room"}}"></i>
{{#if canLeave}}
<i class="icon-logout leave-room" title="{{_ "Leave_room"}}"></i>
<i class="octicon octicon-sign-out" title="{{_ "Leave_room"}}"></i>
{{/if}}
</span>
</a>

@ -1,2 +1,3 @@
Meteor.startup ->
RocketChat.settings.add 'Chatops_Enabled', false, { type: 'boolean', group: 'General', public: true, i18nLabel: "ChatOps Enabled" }
RocketChat.settings.add 'Chatops_Username', false, { type: 'string', group: 'General', public: true, i18nLabel: "ChatOps User Name" }

@ -1,6 +1,6 @@
Meteor.startup ->
RocketChat.settings.add 'Accounts_OAuth_GitHub_Enterprise', false, {type: 'boolean', group: 'Accounts', section: 'GitHub Enterprise', i18nLabel: 'OAuth Enabled'}
RocketChat.settings.add 'API_GitHub_Enterprise_URL', '', { type: 'string', group: 'Accounts', public: true, section: 'GitHub Enterprise', i18nLabel: 'Server URL' }
RocketChat.settings.add 'Accounts_OAuth_GitHub_Enterprise_id', '', { type: 'string', group: 'Accounts', section: 'GitHub Enterprise', i18nLabel: 'Client ID' }
RocketChat.settings.add 'Accounts_OAuth_GitHub_Enterprise_secret', '', { type: 'string', group: 'Accounts', section: 'GitHub Enterprise', i18nLabel: 'Client Secret' }
RocketChat.settings.add 'Accounts_OAuth_GitHub_Enterprise', false, {type: 'boolean', group: 'Accounts', section: 'GitHub Enterprise', i18nLabel: 'Accounts_OAuth_GitHub_Enterprise'}
RocketChat.settings.add 'API_GitHub_Enterprise_URL', '', { type: 'string', group: 'Accounts', public: true, section: 'GitHub Enterprise', i18nLabel: 'API_GitHub_Enterprise_URL' }
RocketChat.settings.add 'Accounts_OAuth_GitHub_Enterprise_id', '', { type: 'string', group: 'Accounts', section: 'GitHub Enterprise', i18nLabel: 'Accounts_OAuth_GitHub_Enterprise_id' }
RocketChat.settings.add 'Accounts_OAuth_GitHub_Enterprise_secret', '', { type: 'string', group: 'Accounts', section: 'GitHub Enterprise', i18nLabel: 'Accounts_OAuth_GitHub_Enterprise_secret' }

@ -88,7 +88,7 @@ RocketChat.settings.add 'Layout_Home_Title', 'Home', { type: 'string', group: 'L
RocketChat.settings.add 'Layout_Home_Body', 'Welcome to Rocket.Chat <br> Go to APP SETTINGS -> Layout to customize this intro.', { type: 'string', multiline: true, group: 'Layout', public: true, section: 'Content' }
RocketChat.settings.add 'Layout_Terms_of_Service', 'Terms of Service <br> Go to APP SETTINGS -> Layout to customize this page.', { type: 'string', multiline: true, group: 'Layout', public: true, section: 'Content' }
RocketChat.settings.add 'Layout_Privacy_Policy', 'Privacy Policy <br> Go to APP SETTINGS -> Layout to customize this page.', { type: 'string', multiline: true, group: 'Layout', public: true, section: 'Content' }
RocketChat.settings.add 'Layout_Sidenav_Footer', '<a href="https://github.com/RocketChat/Rocket.Chat" class="logo" target="_blank"> <img src="/images/logo/logo.svg?v=3" /> <small><i class="icon-github-circled"></i> Fork it on github</small> </a>', { type: 'string', group: 'Layout', public: true, i18nDescription: 'Layout_Sidenav_Footer_description' }
RocketChat.settings.add 'Layout_Sidenav_Footer', '<div><a href="https://github.com/RocketChat/Rocket.Chat" class="logo" target="_blank"> <img src="/images/logo/logo.svg?v=3" /></a><div class="github-tagline"><span class="octicon octicon-pencil" style="color: #994C00"></span> with <span class="octicon octicon-heart" style="color: red"></span> on <span class="octicon octicon-mark-github"></span></div></div>', { type: 'string', group: 'Layout', public: true, i18nDescription: 'Layout_Sidenav_Footer_description' }
RocketChat.settings.add 'Layout_Login_Header', '<a class="logo" href="/"><img src="/images/logo/logo.svg?v=3" /></a>', { type: 'string', multiline: true, group: 'Layout', public: true, section: 'Login' }
RocketChat.settings.add 'Layout_Login_Terms', 'By proceeding to create your account and use Rocket.Chat, you are agreeing to our <a href="/terms-of-service">Terms of Service</a> and <a href="/privacy-policy">Privacy Policy</a>. If you do not agree, you cannot use Rocket.Chat.', { type: 'string', multiline: true, group: 'Layout', public: true, section: 'Login' }

@ -49,3 +49,4 @@ class MentionsClient
return message
RocketChat.callbacks.add 'renderMessage', MentionsClient
RocketChat.callbacks.add 'renderMentions', MentionsClient

Loading…
Cancel
Save