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

Make remote context aware #177

Open
jansmolders86 opened this issue Jan 8, 2015 · 8 comments
Open

Make remote context aware #177

jansmolders86 opened this issue Jan 8, 2015 · 8 comments

Comments

@jansmolders86
Copy link
Owner

To support specific app features and the suggested in app plugins, the remote should be context aware and thus be able to add or remove buttons and functionality.

@Jon889
Copy link
Collaborator

Jon889 commented Jan 9, 2015

I was thinking of adding some kind of actions to mcjs-library-item, currently it would just be "watch" and "edit", and this could be applied to right click menus, pressing enter (a default action could be specified) and also to the remote

@jansmolders86
Copy link
Owner Author

that would be a cool way of doing it as well! adding the context in the app itself. But still, How would you access "off canvas" items, like for instance the view switcher between track view and album view, That's pretty hard to get right with the current setup. I would be a lot easier when - if you open the music app - you get a specific button for that purpose on your remote. Would you agree?

@Jon889 Jon889 closed this as completed Jan 12, 2015
@Jon889 Jon889 reopened this Jan 12, 2015
@Jon889
Copy link
Collaborator

Jon889 commented Jan 12, 2015

Ah yes I hadn't considered off canvas actions. Perhaps create a remote service/factory to have an array of actions that can be sent from the remote and have directives add items to this list, and when they are then it sends messages to the remote page using websockets to show or hide the relevant actions?

Then for off canvas actions there'd be a directive used like: `remote-action="Show hidden" which will add an action to the remote service such that when the respective button on the remote is pressed the directive will call the ng-click handler.

@jansmolders86
Copy link
Owner Author

Very cool Jonathan, So let me get this straight, would the plugin itself control the aditional remote options by adding directives? Or how would that be handled? (trying to paint a picture in my head)

@Jon889
Copy link
Collaborator

Jon889 commented Jan 12, 2015

So like line 31 in movies would be:

label.view-select(mcjs-remote-action="query.hidden ? 'Show Hidden' : 'Hide Hidden'" for="showhidden", ng-init="query.hidden='false'", ng-click="query.hidden = query.hidden == 'false' ? '' : 'false'")

So when the value of mcjs-remote-action is updated it will send a message over web sockets to the remote containing the name, and a button would be added to the remote with the name (or I guess you could supply a URL for an image)? I think this would work, I've not tried any of it.

@Jon889
Copy link
Collaborator

Jon889 commented Jan 13, 2015

I've created a new branch with an implementation of contextual actions. Working for the Show/Hide Hidden button in the Movies app. Is this what you were thinking?

@jansmolders86
Copy link
Owner Author

It looks like a pretty nifty piece of code Jonathan! I'm learning a great deal from you. It's very interesting to see you choose to implement stuff using directives rather than messing about in the dom itself. (what I tend to do to often) Very cool! I'll check out the functionality asap!

@Jon889
Copy link
Collaborator

Jon889 commented Jan 21, 2015

I'm learning as I go along so I hope I'm doing it the right way :) I had trouble with the way I wanted to implement actions on items in the library because it seems impossible to access an elements attributes within in an attributes value, so I think it will have to be done directly in the directives code, which seems slightly less tidy.

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

No branches or pull requests

2 participants