Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] General alert banner #9778

Merged
merged 16 commits into from
Feb 21, 2018
Merged

[NEW] General alert banner #9778

merged 16 commits into from
Feb 21, 2018

Conversation

ggazzo
Copy link
Member

@ggazzo ggazzo commented Feb 20, 2018

  • small version
  • actions
  • close
  • large version
  • deal with large texts
  • timer to close

@RocketChat/core

how to use

alerts.open({html: '<b>Update your Rocket Chat.</b> New version available (v0.65)', action(){alert('hi')}}) 
// or
alerts.open({text: ' Update your Rocket Chat. New version available (v0.65)', action(){alert('hi')}}) 

const params = 
{ 
    title: 'insert your title' ,// bold
    text:'put some text here',
    html:'you can use html to',
    closable:  false, //default
    action: function() { /* some function to be executed on click */ },
    timer: null // time in ms, default none,
    icon: null, 
    modifiers:[...] // ex: ['large'] will set rc-alerts--large class
}

Desktop

image

Mobile

image

large modifier

Desktop

image

Mobile

image

demo

1qrfgg2boh

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-9778 February 20, 2018 03:59 Inactive
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 04:03 Inactive
@RocketChat RocketChat deleted a comment Feb 20, 2018
@RocketChat RocketChat deleted a comment Feb 20, 2018
@RocketChat RocketChat deleted a comment Feb 20, 2018
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 04:11 Inactive
@RocketChat RocketChat deleted a comment Feb 20, 2018
@RocketChat RocketChat deleted a comment Feb 20, 2018
@RocketChat RocketChat deleted a comment Feb 20, 2018
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 05:00 Inactive
@RocketChat RocketChat deleted a comment Feb 20, 2018
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 05:27 Inactive
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 05:29 Inactive
@ggazzo ggazzo changed the title [WIP][NEW] General Alerts [NEW] General Alerts Feb 20, 2018
@RocketChat RocketChat deleted a comment Feb 20, 2018
@sampaiodiego
Copy link
Member

I think the font-size should be a bit smaller.. same size as channel name for example

@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 14:22 Inactive
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 16:25 Inactive
@ggazzo
Copy link
Member Author

ggazzo commented Feb 20, 2018

@sampaiodiego changed the font size

@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 18:16 Inactive
});

Template.alerts.helpers({
isSafariIos: /iP(ad|hone|od).+Version\/[\d\.]+.*Safari/i.test(navigator.userAgent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using this helper?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet... I think that helper should be a global one..

@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 19:51 Inactive
@rodrigok rodrigok temporarily deployed to rocket-chat-pr-9778 February 20, 2018 22:32 Inactive
@rodrigok rodrigok mentioned this pull request Feb 20, 2018
6 tasks
@rodrigok rodrigok added this to the 0.62.0 milestone Feb 20, 2018
@rodrigok rodrigok added this to Desirable in 0.62.0 via automation Feb 20, 2018
@rodrigok rodrigok moved this from Desirable to To Do in 0.62.0 Feb 20, 2018
@ggazzo ggazzo temporarily deployed to rocket-chat-pr-9778 February 20, 2018 23:47 Inactive
@rodrigok rodrigok moved this from To Do to In progress in 0.62.0 Feb 21, 2018
@rodrigok rodrigok moved this from In progress to Review/QA in 0.62.0 Feb 21, 2018
@rodrigok rodrigok changed the title [NEW] General Alerts [NEW] General alert banner Feb 21, 2018
@rodrigok rodrigok merged commit e92e59b into develop Feb 21, 2018
0.62.0 automation moved this from Review/QA to Done Feb 21, 2018
@rodrigok rodrigok deleted the alerts branch February 21, 2018 02:37
@rodrigok rodrigok mentioned this pull request Feb 28, 2018
@raymondfeliz
Copy link

My apologies, I see that there is a section for "How to use" but im not exactly sure how to use this feature. Is there a place where I have to insert those lines? Im sorry if this is a silly question! :(

I updated a test server of mine to 0.62.0 just to play with this specific feature, im extremely grateful that you added this!

@geekgonecrazy
Copy link
Member

It's an internal API level feature. It can be used from another package. In the future it might be exposed in other ways

@raymondfeliz
Copy link

Is there perhaps a ste-by-step guide with an example on how to use this feature?

I went ahead and started trying to figure it out but havent gotten far sadly.

I can query and auth against the API with

curl -H "Content-type:application/json"
http://localhost:3000/api/v1/login
-d '{ "username": "--username--", "password": "--password--" }'

From there I have an auth token and a user ID to execute other api calls, but I cant figure out how to call on yours. Im sure its something really simple that im not aware of.

Im thinking of writing a quick little web app to interact with the API to change these messages from a gui once I figure out how the calls are made.

Thanks in advance!

@geekgonecrazy
Copy link
Member

Its not exposed via the rest api. Its an internal api. Which means you would have to create a meteor package and compile it to use it.

I'm not sure on the plans, but a rest api endpoint my be created to allow using it that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.62.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

8 participants