Commit Graph

26 Commits

Author SHA1 Message Date
Anders Kaseorg db0b33842c templates: Replace templates.render with require calls.
This removes an unnecessary layer of indirection and allows webpack to
catch filename mistakes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Armaan Ahluwalia 6d255efe4c app: Prepare JS files for consumption by webpack.
This commit prepares the frontend code to be consumed by webpack.

It is a hack: In theory, modules should be declaring and importing the
modules they depend on and the globals they expose directly.

However, that requires significant per-module work, which we don't
really want to block moving our toolchain to webpack on.

So we expose the modules by setting window.varName = varName; as
needed in the js files.
2018-07-05 10:53:36 +02:00
Tim Abbott 7ab8a8e820 js: Fix a bunch of indentation issues found by eslint.
This is preparation for enabling an eslint indentation configuration.
90% of these changes are just fixes for indentation errors that have
snuck into the codebase over the years; the others are more
significant reformatting to make eslint happy (that are not otherwise
actually improvements).

The one area that we do not attempt to work on here is the
"switch/case" indentation.
2018-05-06 16:25:02 -07:00
Alena Volkova abe4196232 urls: Change the method for adding alert words from PUT to POST. 2017-09-26 14:00:51 -07:00
Harshit Bansal 0e8f1f4e5d alert_words: Fix the UI to not allow users to create duplicate alert words. 2017-06-13 16:37:49 -07:00
Harshit Bansal 94fc7dfe20 alert_words_ui: Fix the data flow while removing an alert word.
Add `remove_alert_word()` function which uses the correct data flow
while removing an alert word.

`alert_words_ui.js` was structured differently from most of the other
settings. It was not using the triggers from the server for running
the success/failure handlers.
2017-06-13 16:36:11 -07:00
Harshit Bansal 049bc02778 alert_words_ui.js: Fix the data flow while adding alert word.
Modify the `add_alert_word()` function to follow the correct data
flow for error handling and propagation.
2017-06-13 16:36:11 -07:00
Harshit Bansal d5ab8ac1e1 alert_words: Remove the `page_params.alert_words` after initialization.
We remove the `page_params.alert_words` since `alert_words.words`
is the sole source of alert words. Use of `page_params.alert_words`
could lead to bugs when alert words are updated since it is not updated.
2017-06-13 16:36:11 -07:00
Harshit Bansal 614817e5fc alert_words_ui: Add `render_alert_words_ui()` function.
This function will be used for rendering the alert words list.
2017-06-09 15:23:53 -07:00
Harshit Bansal 643936454e alert_words_ui: Convert error message alert to status message alert.
Convert the error message alert to a status message alert which can be
used to display the status of any operation performed.
2017-06-09 15:23:53 -07:00
Raghav Jajodia c1dfa348a1 alert_words: Trim whitespace around alert words.
"Add a new alert word" box now displays an alert when filled with only spaces.
Fixes #3369
2017-02-16 21:06:18 -08:00
Rafid Aslam 7856217a63 Migrate JS modules to CommonJS style.
Closes #1488.
2016-12-07 16:11:52 -08:00
AZtheAsian 5e9918135b eslint: change quote-props from off to error and fix violations. 2016-12-02 18:35:53 -08:00
Tim Abbott 9ed5ccd332 alert_words: Use the ID to reference create_alert_word_button. 2016-09-19 14:23:11 -07:00
Preston Hansen 87e485c89f Add error message when user attempts to submit empty alert word.
Resolves #1194.
2016-07-13 21:07:20 -07:00
Preston Hansen 57dec15c6c Update alert word UI to match the style of bots.
Resolves #1075.
2016-06-24 16:43:19 -07:00
Ashish 8fc8717409 Replace json/set_alert_words with REST style route. 2016-04-11 21:38:22 -07:00
Jessica McKellar 5f7df38b8a Unbreak custom alert words on the settings page.
This doesn't change the alerting UI logic, it just turns
alert_words_ui into a module and calls the setup code from settings.js
when the settings page is rendered.

(imported from commit 05f95383b046086641280f82f648be58688efe61)
2014-03-04 18:06:48 -05:00
Tim Abbott 7f174213ed Add an idempotent flag to the channel module.
(imported from commit d5b867d2a8f176cae76c8b68435c4fab318d998b)
2014-01-10 21:39:00 -05:00
Tim Abbott 795930c803 Add channel module wrapping our various JSON requests to the server.
(imported from commit 6489938678551ad8594822363ae6d1c9ae295496)
2013-12-19 16:52:47 -05:00
Steve Howell bb3eca70c7 Allow enter key to submit an alert word.
This fixes a mild regression in 6bd2a0315ff56a20027074d65ccaa094bd35e63f,
which fixed a bigger bug.  That change added the event parameter to
add_alert_word(); this change updates one of the callers to now
supply it.

(imported from commit c6375abb8bd22d12c538cd7439462aae4665ee38)
2013-11-08 10:36:37 -05:00
Jessica McKellar 07959dc6d9 alert words: fix accidental use of a global variable.
The global in question was `event`, set to:

MouseEvent {dataTransfer: null,
            toElement: button.btn btn-mini add-alert-word,
            fromElement: null, y: 442, x: 763…}

in Chrome. This does seem to be the correct event.

In Chrome, this global variable existed, so the code path didn't error
out. In Firefox, the global variable didn't exist, causing adding
alert words to fail.

(imported from commit 6bd2a0315ff56a20027074d65ccaa094bd35e63f)
2013-11-07 11:50:01 -05:00
Jessica McKellar fdb5863687 Allow alert words to be multi-word.
(imported from commit ccf8a387a25d079cf43ed335f6dc9debd70db75d)
2013-11-06 11:43:34 -05:00
Allen Rabinovich 3a5276aa4e Settings page changes
Bug fixes

Small fix to integrations and api links

(imported from commit 5944b175fbe0fdc4fdb5ecb3cab4e333127ca353)
2013-10-22 23:28:46 -07:00
Steve Howell b98e7f8d90 Remove transitional feature_flags.alert_words flag.
(imported from commit f00eba8a12054e9771105e341e2652a53271e298)
2013-10-15 09:57:19 -04:00
Steve Howell 682414e13c Move code to alert_words_ui.js
(imported from commit 78797e690ced954fc79f854efebe5945dd360bde)
2013-09-09 12:06:45 -04:00