caitp / angular-semantic

AngularJS directives for Semantic-UI
413 stars 47 forks source link

feat(buttons): added checkbox and radio buttons #33

Closed m0t0r closed 4 years ago

m0t0r commented 10 years ago

I have created directives for checkbox and radio buttons respectively. I have a few things to discuss:

1) Should I create a directive which can toggle on click a custom name? (Semantic-UI has an example as the first button. When a button has a name once its cliked name changes) - as I guess I will need to use transclude 2) is the naming style of directives good? 3) Not so sure about docs style. I saw yours as a guide. Is that alright?

Hope it would be fine!

caitp commented 10 years ago

+1 for the tests

caitp commented 10 years ago

1) Should I create a directive which can toggle on click a custom name? (Semantic-UI has an example as the first button. When a button has a name once its cliked name changes) - as I guess I will need to use transclude

In my mind, if you're toggling between 2 values, it probably looks more like this:

<se-btn-confirm se-label="Quit" se-label-confirm="Are you sure?"></se-btn-confirm>

or something like that. I'm not totally sure if you can transclude text nodes, but I guess it's fine to try it if you need to.

2) is the naming style of directives good?

I'm not picky about it --- as you've seen, I was previously using no naming convention. I think adopting one would be good. I'm not totally keen on se-btn-* though, what about se-radiobutton and se-checkbutton or something? They're longer, but they make more sense in my head. Anyways, like I said I'm not picky about it, so go with the one you like best.

3) Not so sure about docs style. I saw yours as a guide. Is that alright?

The doc generator used here is a fork of https://github.com/m7r/grunt-ngdocs --- which is based on Angular's old doc generator. There used to be a guide on angular's wiki page about how to use it, but it's since been moved over to a new generator (dgeni) instead. It might be a good idea to port the docs site over to dgeni, but I'm not sure how much work it would be just yet. Probably not a lot since the library is tiny.

So, that doesn't really answer your question but basically, yeah just follow the example. It's similar to jsdoc.

m0t0r commented 10 years ago

@caitp, thank you for the answers. About toggle button directive, in my mind there was an idea to bind name to the model and let controller to change it. Could be something like: <se-btn-toggle init-btn-name="Click me"></se-btn-toggle> and in markup something like: <button class="btn toggle hover">{{ seBtnName }}</button> then once the button is clicked and all things relating to it are finished $scope.seBtnName = "Clicked" in a controller, as an example. So that a button could potentally have a few differet names representing current state. What do you think about it?

caitp commented 9 years ago

So, as for the name thing, someone suggested a sem- prefix a while ago, and I kinda like it, lets change over to that.

I don't know how useful it will be, but the build is customizable anyways so it shouldn't hurt.

When you have time to just update the directive names to use the prefix and it should be good to land.

I don't totally get what you mean with the toggle-button directive, it seems like the kinda thing you'd typically just use ng-click for --- but if it's a matter of developer ergonomics and it looks like an improvement, I'm open to it.

(obviously not much has been happening in this repo for a while, so there can't be too many people using this module any how --- developer ergonomics may not matter a whole lot for this reason).