Is there a way I can re use view template files in ionic? - ionic-framework

I am very new to angualrjs and ionic, so for my application i have a set of html code which is reused in multiple view templates. Is there a way I can move those repeated code to a file and include in the templates as I wanted.
Eg - I have a three different types of product details pages each have a block which shows the product price details. So If I can move the price part to another template file I can maintain/modify those part easily.

Related

How to combine authorable css files in css.txt in aem

We have an existing AEM application where there are 100s of pages. On most of the pages, different css files are getting loaded via a separate network call. We need to optimize this. What I am thinking is if we can:
1. Author the list of css files on the page as a page property.
2. In our code, this page property is read and all the css files mentioned as a property value get combined and rendered on the page. Similar to what is done in css.txt file or embed property.
Please suggest.
Their are few ways to reduce the network calls for css files in AEM
1) Add the css files at the template level so that all the css files are loaded once.
2) Instead of adding the category of the clientlibs use the embed property of the clientlibs. AEM will combine all the clientlibs provided in the embed property into a single clientlib and their will be only network call. But the size of the css file may increase after combining and it will effect the page load time for the first time.
But if your requirement is to author the css files then I will suggest you have a dropdown kind of property in your dialog where all your css files are displayed and the author can select the css according to the need. Once selected then you can apply those css to the html by reading through sightly.
So, it seems you don't want to or cannot use the clientlib functioanlity which is an ootb AEM feature.
No matter what solution you choose - maybe a frontend JavaScript snippet that can decide which CSS files would be needed, or some logic that builds CSS includes at render time based on the components used in the page, or something completely different - I would strongly suggest not to put the CSS files to be used in the editor's responsibility.
If they need some additional styles to be set, use the Adobe Style System. But do not abuse page properties for CSS file configurations.
I mean "hundreds of pages" sounds like a rather small site, but it might still increase your maintenance efforts a lot, when the first people start to complain about wrong colors or font sizes...

Whats the difference between content and structure folders in AEM

I am using Adobe Experience Manager (AEM) 6.3. In the basic structure, components folder contains content and structure folders.
In both the folders we put components. What is the difference in both the folders?
In simple terms, Components which are responsible for rendering the skeleton or the outermost part of the page are placed in the structure folder where as components which render only parts of the page are placed in content folder.
Note that this is just a best practice recommendation from Adobe, you can maintain folders with custom names as well.
In older versions of AEM, components in structure folder were placed in page folder and were called page components.
High-level flow of how structure and content components integrate in a page -
To create a page in AEM, you'll have to select a template.
A template is first created in /conf folder. Templates are usually backed up(sling:resourceType of the template points to structure component) by a structure component to render the initial view. Common structure components includes header, footer, body which usually contains container components like parsys or responsivegrid.
A page is then created using the template created above and the content author uses functional components (components in content) to design the page - drag and drop from components side rail or sidekick in previous versions.

RTF Template Common Header/Footer

By working with multiple user templates in the project, I created a master document to aggregate some model document with the wanted packages inside (requirements, use cases, etc).
During some common changes to the templates, I find it very frustrating to edit header and footer one by one template file.
Is there not a way to define a header/footer stylesheet to apply to all or certain user templates?
Yes, you can define header and footer in either the cover page template, or the table of contents template.
This header/footer will then be used by all subsequent templates.
The only caveat is that all subsequent templates will override the header/footer if they define one for themselves, even if the header/footer is empty.
And since there is no way to get rid of a header, in a template, you'll have to create a new template and copy the contents of the original template into the new template.

Ionic big project structure

I'm building a mobile app that is a port from a web-app and I'm trying to create the skeleton.
I have an admin center with a lot of different views that share one thing in common, they show all registers, create, update and delete. For example, I have one section for users where the first page shows all users, then there is a button to create and one for update that sends to different views.
The project skeleton would be something like this:
/users
users.html // show all users
users_create.html // creates user
users_update.html // update specific user
users_detail.html // show specific user
/posts
posts.html
posts_create.html
posts_update.html
posts_detail.html
/communities
communities.html
communities_create.html
communities_update.html
communities_detail.html
.... much more the same for other sections
My question is, what would be the best approach to build this with ionic? to have all this folders or just one common folder and resolve everything (number of fields, name of fields, etc) by passing a param to the route?
I ask you sorry if I didn't explain it very well but I hope you catch the idea of what I'm trying to say.
Thanks!
From the awesome book MEAN Web Development by Amos Haviv you can learn that there are basically two folder structures you can opt for:
Horizontal folder structure
A horizontal project structure is based on the division of folders and files by their functional role rather than by the feature they implement, which means that all the application files are placed inside a main application folder that contains an MVC folder structure. As you can see, the horizontal folder structure is very useful for small projects where the number of features is limited, and so files can be conveniently placed inside folders that represent their general roles.
Vertical folder structure
A vertical project structure is based on the division of folders and files by the feature they implement, which means each feature has its own autonomous folder that contains an MVC folder structure.
So, in your case, what I would actually do is go with the Vertical folder structure (since you said the app is (is going to be) big, where you would (in your case) have a users folder where you would then have folders controllers, views, model (in case you're using it) and all the appropriate files inside it. You can view the folder structure in action if you take a look at the project mean.js from the same author as the book.

Zend_Translate Help - Slovak Languege

I need to just translate form error messages in my application.
The application is not multilingual, it is al in Slovak (so I already write labels and stuff in Slovak language), just need to translate error messages.
I have made this method in my bootstrap file:
protected function _initTranslate()
{
$this->translate = new Zend_Translate('gettext',
'/path/to/translation/source-sk.mo',
'sk');
Zend_Form::setDefaultTranslator($this->translate);
}
But how to create the source-sk.mo file? Do I need to download it somewhere from the Web?
First you will need to download the PoEdit software and then you will need to configure it according to this post.
Once you have completed those steps, you will need to create a new catalog file from within PoEdit. In the creation dialog, click on the keywords tab, and then add function names that you wish to scan for in your code. With Zend Framework, this is typically just translate since you are probably using the translate() view helper. However you will want to also include setLabel so that it pulls your Zend_Form labels as well.
After you have created your catalog, you will need to scan your source code for translations. You do this by clicking Update from Sources under the Catalog menu. Once it has completed scanning your source code, it will display a list of all strings that need to be translated. You then go down the list and enter in the translation for each string. Now save the catalog to somewhere within your ZF application, preferably /languages, point your Zend_Translate declaration to this location and you are good to go.
If you adjust any labels or strings later on, you can always reopen the catalog with PoEdit, run Update from Sources again and it will pull all of the new changes for you to translate.