Meteor with framework materialize - user-interface

I planned to use materialize:materialize package to a meteor app. As I can understand materialize use a lot of javascript for effects, collapsing and so on. Meteor has its own event handling but I suppose materialize will use jquery (I suppose I don't need to add jquery, it's included, or?) and will be running outside meteor events.
Is it enough to just add the package and everything will work, not just the look but also the javascript (feel)? I am trying to get it to work with a materialize template I bought and its not optimezed for meteor so I have problems to make it work.
Has anyone try this setup and is there any suggestions for good sources.

Using materializecss with Meteor works great, but you will have to initialize jQuery plugins yourself (just like in a regular HTML5 app without Meteor, as Materialize docs hints at).
Meteor templating system includes automatically jQuery, and you will have to use template.onRendered to correctly initialize the plugins, as opposed to initializing them in a $(document).ready callback.
For example, here is a simple Materialize dropdown markup inside a Meteor template :
<template name="myDropdown">
<a class="dropdown-button" data-activates="my-dropdown">
My Dropdown <i class="mdi-navigation-arrow-drop-down right"></i>
</a>
<ul id="my-dropdown" class="dropdown-content">
<li class="js-first-item"><a>First item</a></li>
<li class="js-second-item"><a>Second item</a></li>
<li class="divider"></li>
<li class="js-third-item"><a>Third item</a></li>
</ul>
</template>
And here is the according plugin initialization :
Template.myDropdown.onRendered(function(){
this.$(".dropdown-button").dropdown({
hover:false
});
});
You should use standard Meteor events to handle user interaction :
Template.myDropdown.events({
"click .js-first-item": function(event, template){
console.log("clicked on the first item !");
},
[..]
});
Overall, your Materialize theme integration into your Meteor app is not something as trivial as droping the theme inside your source files and meteor adding materialize:materialize, but it should not be something overly difficult.
Sometimes you'll hit Meteor related issues when trying to initialize Materialize plugins but the corresponding markup is not yet rendered into the DOM, see this question for a possible solution : Meteor + Materialize: collapsable in for each doesn't work

Related

About Web Page Development with Drop down menu & submit button

I want to develop a web page with following details.
I have three different drop down menu & 9 images & 1 submit button.
So according to drop down combination I can see 9 different images with help of Submit button.
Please suggest me .
I suggest you use bootstrap for your html responsive designs like drop down menu and submit buttons and javascript related functionality.
Find bootstrap tutorial in tutorialspoint.com.
All you need if just to use the appropriate class in the tag to make a drop down.
Like example:
<div class="nav-bar">
<ul class="dropdown">
<li>my list</>
</ul>
</div>
thats how easy it can be to make a drop down menu with bootstrap.
Find the tutorial or search for it in google with this search query: "tutorialspoint: bootstrap tutorial"

how to embed ReactJS components into blade template?

I'm ReactJS developer (react, flux, react-router, gulp, nodejs etc...).
How do I embed react components into blade template?
Or, at least, where should I start searching for answer?
Please, let me know, if I can provide any more useful information on this case.
You don't embed them in your blade template, your template provides a DOM element which the React component can render its output to. For example, in your template you have:
<div id="root"></div>
and in your javascript/jsx:
React.render(<MyComponent/>, document.getElementById("root"));

How can I put Component into Module in Joomla! site?

I wonder if exists a way to put component into module without install plugin, neither component nor module.
Thanks and my apologize for my bad English.
First, should unable Editor from configuration site, in Panel Admin. Then, go to Extension -> Plugins -> TinyMCE and delete forbidden items "script".
Now, go to "create module", with custom HTML5 and put something like this:
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<div id="new-projects">
</div>
<script type="text/javascript">
$( "#new-projects" ).load( "urlOfYourComponent #idYouWouldShow" );
</script>
Thanks to Ilias cause the idea.
The only way to achieve this without installing any extensions is via a custom HTML joomla module where you'll place your component in an iframe.
Then if you want to load only the component part of the fetched page in the iframe use jquery's load function.
If i'm correct, You don't wanna install any kind of extension that do that, you ask for vanilla possibility to put component into module, so this is the answer, there is no way to put whole component into module. Partial Example: You can put article into custom HTML module or list categories into modules, but you will never see whole component into module. Why? Because component its a core thing on site, like people in building (or even the whole building) eg. house, and module is like painting on the wall, You can't put building on the painting.

How to work with several view sections in a single layout (Ember)?

I'm trying to create an application which has a content view and a sidebar to the left. I'm having trouble understanding how I should implement the Menu which resides in the sidebar. Naturally I would like it to be it's own module with a controller and everything but I've been finding a lot of issues that arise when trying this. My application template has an outlet where I put the content and I include the menu with {{view}} but then I can't connect it to the controller which it belongs to.
I've tried the solution proposed at http://jsfiddle.net/tzYE7/7/ and it will let me access the properties of the controller, but the events doesn't get executed. Then I tried integrating the menu into the ApplicationController instead but that doesn't seem very elegant and rather messy. I also would like to connect a model to the menu and I believe that this would get pretty confusing if I try to incorporate all this in ApplicationController. The things is that I don't want the menu to simply be static, I would like to be able to hide and show it on command.
I'm pretty new to the framework and I'm trying to wrap my head around it's workflow and how to connect all the bits and pieces. Any idea on how to do this properly?
Edit:
"the emple jsfiddle you have provided is using the the old router, can
you actually post your current code, this will make it easier to help
out" – intuitivepixel
Since it's a more of a framework related question and not regarding my code I figured it wasn't really neccessary, but I will try to elaborate further.
What I got is basically an application template:
<script type="text/x-handlebars" data-template-name="application">
<aside id="sidebar">
{{view App.MenuView}}
</aside>
<section id="content>
{{outlet}}
</section>
</script>
What I first discovered was that no controller properties was accessible in the Menu-template. I found this mentioned in the following in a github issue (https://github.com/emberjs/ember.js/issues/1712) that's also where I found a reference to the jsfiddle that suggested that I connected the controller within the view that was inserted:
App.MenuView = Ember.View.extend({
templateName: 'menu',
init: function() {
this._super();
this.set("controller", App.MenuController.create());
}
});
However, No events are delegated to MenuController, so something is still not working. That was when I tried integrating everything into ApplicationController instead.
What is the standard way of doing this in Ember? I also want to be able to hide/show the menu from other controllers in the application but it seems like the other controllers must depend on the Menu controller for that to work, can't it be done with events instead?
That's basically what I'm wondering. Thank you for your time and knowledge! :)

Meteor: account login link takes time to load

I have started a meteor application using the accounts packages for facebook, twitter, github and auth accounts. For UI, I am using the bootstrap package. Whenevee I load my site projectx.meteor.com, the login links take some time
I have everything static on the HTML page, except for the link to login:
client/x.html:
<div class="masthead">
<ul class="nav nav-pills pull-right">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
<li>{{loginButtons}}</li>
</ul>
</div>
There is no JS on the client side and I have called the startup method on the server.
Server/startup.js:
Meteor.startup(function () {
});
Also, when I visit the above URL from IE 9 on my Windows Phone 7.5, it doesn't show the login link at all.
Update: After the comment below, I modified my code to remove packages and additional HTML. The packages now included are:
preserve-inputs
accounts-ui
accounts-password
accounts-facebook
accounts-twitter
accounts-github
I have removed bootstrap and the only thing on my template now is {{loginButtons}}, It still loads the login link after a delay. Is this the default behavior of the accounts package ?
The reason why the buttons take so long to load is because Meteor has to ask the server-side for the necessary configuration information (located in a collection in your Mongo instance) before it can render the login buttons for each of the external services you want to use. I think the best solution (and the solution I use) is to simply build the buttons client-side if you want faster results or tweak the login buttons template to allow for data ported in from the client-side using a JSON object with all the OAuth keys it needs.
As you say, this is the default behavior.
There is no problem about bootstrap or js in your code.
I cant explain exactly why but it works that way.

Resources