Semantic-UI-Angular icon indicating copy to clipboard operation
Semantic-UI-Angular copied to clipboard

Create Contributing Guidelines

Open m0t0r opened this issue 10 years ago • 11 comments

m0t0r avatar May 25 '15 15:05 m0t0r

I think it could be a good idea to follow John Papa's style guide https://github.com/johnpapa/angular-styleguide

RomainLanz avatar Jun 03 '15 14:06 RomainLanz

I'll try to get in here on the weekend. For this moment, if you're following:

you are good to go.

m0t0r avatar Jun 03 '15 23:06 m0t0r

But for the moment some directive do not follow John Papa's style guide. Do we need to refactor them?

RomainLanz avatar Jun 04 '15 07:06 RomainLanz

What do you think of...

The file need to have the name of the directive suffixed by directive. e.g. sm-accordion.directive.js

Your file need to contain only one directive! Your boilerplate need also to follow IIFE syntax and use use strict like below.

(function() {
    'use strict';

    //

})();

All of your function need to be named and you need to create them after the return statement. You also need to create nested function if necessary

(function() {
    'use strict';

    angular
        .module('app.widgets')
        .directive('smAccordion', smAccordion); // Named function

    function smAccordion() {
        var directive = {
            restrict: 'E',
            replace: true,
            transclude: true,
            template: template, // Named function
            link: link // Named function
        };

        return directive; // Return statement

        function link(scope, element, attrs, ctrl, transclude) {
            transclude(scope, transcludeFn); // Nested named function

            function transcludeFn(nodes) {
                // Transclude stuff
            }

        }

        function template() {
            return  '';
        }
    }
})();

The first expression of the link function should be transclude if it exists like the example above. After that you need to have all var's definitions and after all bindings to an element.

function link(scope, element, attrs, ctrl, transclude) {
    transclude(scope, transcludeFn);

    // Var's declarations
    var active = attrs.active || false;

    // Bindings
    element.on('click', toggle);

    // Functions
    function toggle() {
        // Toogle stuff
    }

    function transcludeFn(nodes) {
        // Transclude stuff
    }

}

RomainLanz avatar Jun 04 '15 13:06 RomainLanz

@m0t0r @caitp Please when you get a chance send me an email at [email protected].

I'm hoping to send off a kickoff email to organize all the people interested in getting involved in this project and I don't have your e-mails.

jlukic avatar Jul 29 '15 17:07 jlukic

I totaly agree to use John Papa's styleguide. :+1:

marcotas avatar Aug 13 '15 22:08 marcotas

+1

thinq4yourself avatar Sep 28 '15 15:09 thinq4yourself

As we are thinking of using angular 1.4 with ES6 is legal research on things like: https://github.com/johnpapa/angular-styleguide/issues/390

matheuspoleza avatar Nov 27 '15 22:11 matheuspoleza

Further to documentation and contribution guide, we should also chat about approach and goals of the project.

kowsheek avatar Dec 09 '15 21:12 kowsheek

@kowsheek its a good scene. My intention was to create a first release with some references as: angular-bootstrap, angular material, but we need to discuss where to go.

matheuspoleza avatar Dec 09 '15 21:12 matheuspoleza

Few thoughts I would like to share:

  • angular material approach would be awesome, the deep integration is what I've love to see in my projects.
  • It'd be awesome to get the more complex elements angularified first. For example, if the SemanticUI tabs could be used for navigation with ngRoute or ui.router.
  • Modules should be grouped as they are in SemanticUI (as seen in the left menu of the docs): Elements, Collection, Views. The Components could their individual modules. I find it redundant that we have to include individual items in other libraries (looking at you angular-bootstrap).

kowsheek avatar Dec 09 '15 22:12 kowsheek