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

[CLOSED] Dialogs should be templatized #256

Open
core-ai-bot opened this issue Aug 29, 2021 · 9 comments
Open

[CLOSED] Dialogs should be templatized #256

core-ai-bot opened this issue Aug 29, 2021 · 9 comments

Comments

@core-ai-bot
Copy link
Member

Issue by njx
Tuesday Feb 14, 2012 at 21:10 GMT
Originally opened as adobe/brackets#258


Currently, each different type of dialog we create has a separate chunk of HTML in the main index.html file. We should collapse these into a single chunk that is used by a flexible dialog function that allows the user to specify button labels, etc. We could also use a templating framework to help with this, although it's probably not a requirement.

@core-ai-bot
Copy link
Member Author

Comment by njx
Tuesday Feb 14, 2012 at 21:10 GMT


See TODO in brackets.showModalDialog().

@core-ai-bot
Copy link
Member Author

Comment by njx
Tuesday Mar 20, 2012 at 18:01 GMT


QRB reviewing. Marking code cleanup--we should at least factor things so we don't have a bunch of different divs with almost the exact same structure in the HTML.

@core-ai-bot
Copy link
Member Author

Comment by idflood
Wednesday May 16, 2012 at 22:10 GMT


I wanted to give this issue a shot but first I would like to know if what I'm thinking sounds right.

First the showModalDialog needs to be changed so that it accept an additional argument. This argument could be a simple object defining the buttons like {dontsave: "Close (Don't Save)", cancel: "Keep Changes in Editor"}.

Since brackets already use require.js we then can use the text plugin to load additional *.html files just like javascript dependencies : http://requirejs.org/docs/api.html#text

The next step would be to use an existing templating engine like underscore (http://underscorejs.org/#template) or http://handlebarsjs.com/ or any existing library.

What do you think?

@core-ai-bot
Copy link
Member Author

Comment by njx
Friday May 18, 2012 at 23:25 GMT


That sounds right. I think we don't need to go as far as using a real templating library for now--we can just have a single basic dialog structure with defined IDs, and then stuff content into those IDs manually. We could worry about true templating later.

@gruehle -- what do you think about using the RequireJS text plugin to start breaking up our HTML file into separate fragments? Any reasons not to go that route?

Thanks for looking into this!

@core-ai-bot
Copy link
Member Author

Comment by gruehle
Saturday May 19, 2012 at 01:09 GMT


Using the RequireJS text plugin sounds like a good approach. With this plugin, the templates can be authored in separate files, but concatenated together (optionally with JavaScript files) for optimization.

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Thursday Oct 25, 2012 at 16:41 GMT


@njx I just ran across the TODO comment in the code for this one. This can be closed, right?

@core-ai-bot
Copy link
Member Author

Comment by njx
Friday Oct 26, 2012 at 00:39 GMT


No, we haven't actually templatized our dialogs yet--they're still all separate <div>s in main-view.html. (They are using Mustache to fill in the localized strings for the buttons, but the actual dialogs themselves are not templates.) The idea of this bug was to make it so that we could have a single chunk of HTML for all (or most) dialogs, and make it configurable from JS.

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Thursday Jun 06, 2013 at 20:29 GMT


Another issue that was fixed by #3086 :)

@core-ai-bot
Copy link
Member Author

Comment by njx
Thursday Jun 06, 2013 at 20:52 GMT


Yay! Closing.

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

No branches or pull requests

1 participant