I have been trying to enable auto-fill to grab slack channel list in my app and wondering if there is any api available that would let me search both public and private channels based on user input queries like if i want to look for "slack admins" private channel if i type "sl" it should give me list of all channels with those 2 letters in subsequent way . its basically search of channel names
Usually auto complete will only work for public channels, but there is a way to get it to work with private channels too.
Retrieve the list of private channels with groups.list
Build a Message Menu using the list of private channels as items (using the "Simple Menu" approach)
You will get a drop-down menu with a search box that has a build-in autocomplete feature for all menu items.
Related
I'm looking to change an internal Roomle parameter from externally from a webpage. I have 3 icon menus within roomle, the webpage that the Roomle is hosted on has users logins, so depending on who has logged in I want to hide certain Roomle Icons Menus, for example if Person1 is logged in I want to set the internal Roomle parameter of allowSplinta==true, allowCB==true, allowTB==true but if Person2 is logged in I want to set allowSplinta==false, allowCB==true, allowTB==false, so Person2 will only see 1 icon menu.
I see from the documentation this seems to be possible but unsure how to implement it, there is a section on the roomle site "Parameter Implementation outside of the configurator iFrame"
As you mentioned there is a section in the docs which explains this.
Basically you have to make sure the configuration is loaded (await loadObject) and then get all the parameters using your configurator instance:
const params = await configurator.extended.getParametersOfRootComponent();
If you know which parameter you want you can search it in the params array:
const viewParam = params.find(({key}) => key === 'door');
All valid values for this parameter are then stored in validValues (viewParam.validValues).
You can then use setParameterOfRootComponent to set the desired value:
configurator.extended.setParameterOfRootComponent(viewParam, value)
I created a CodeSandbox where you can take a look at the full example.
I have to add a custom field ie. Drop List of country and auto populate the Drop List of cities on selection of respective country in Sitecore Client.
If possible we have to take the list of Countries and Cities from the Content Item.
There is nothing like this out of the box in Sitecore. What you need to do is to implement custom Sitecore field.
Short tutorials how to build one can be found:
https://sdn.sitecore.net/articles/api/creating%20a%20composite%20custom%20field/adding%20a%20custom%20field%20to%20sitecore%20client.aspx
http://www.sitecore.net/learn/blogs/best-practice-blogs/martin-knudsen/posts/2012/09/creating-a-custom-sitecore-field.aspx
And here you can find an answer how to build a custom field which uses one dropdown depending on another: Sitecore grouped droplist
I am building a RESTful API for a web site that allows users to create widgets and tabs containing widgets (think igoogle.com/ netvibes.com) and I want to share my URL design for your insights.
Here are the simple rules:
There is a static list of widgetTypes available for a user to pick.
A user can create one or more widgetInstances of each widgetType.
A user can create one or more tabs/ dashboards containing widgetInstances
This API needs to only serve JSON that will be consumed by JavaScript. We can also assume that all authentication will be taken care of through cookies.
The API needs to serve:
CRUD of user's Tabs
CRUD of specific user widgetInstances
Retrieval of all tabs for a user
Retrieval of all widgetInstances for a given tab.
Retrieval of all available widgetTypes for a user to add widgets from.
Design:
Tab controller:
widgetAPI.com/tabs -> Returns meta data (id, title) of all tabs available to a user.
widgetAPI.com/tabs/1 -> Returns meta data (title) of tab id 1. If sent with POST, updates tab id 1.
widgetAPI.com/tabs/1/widgets > Returns all widgetInstances of tab id 1.
Question 1: Ideally I'd like to follow the design of widgetAPI.com/tabs/1 also returning all the widgetInstances of the given tab but with that design, widgetAPI.com/tabs may return far too much data as I would have to return all the widgets for all the tabs. Hence I need to create a separate "widgetAPI.com/tabs/1/widgets" URL but that also has to return the tab meta data as I don't want to make two HTTP calls to get meta data & widgets. Please advise as I am not sure of the best approach here.
widgetAPI.com/tabs/create -> Create a new tab
widgetAPI.com/tabs/delete/123 -> Delete tabid 123
Widget Controller:
widgetAPI.com/widgets/123 -> Return data for widgetInstanceId 123. Updates 123 if sent through POST.
widgetAPI.com/widgets/Create?typeID = 2 -> Creates a new widgetInstance of typeid = 2. This will only be a POST request so typeId could be a post parameter.
widgetAPI.com/widgets/delete/123 -> Delete widgetInstance 123
Question 2 So there is one rule I havent been able to fulfill yet. I need to return all the widgetTypes available and I am not sure how to fit this request into the previous two controllers. I am currently leaning towards just serving this separately. So something like widgetAPI.com/getWidgetTypes. Thoughts?
Thanks guys. If you could critique on the overall design, just address the questions or mention anything I should watch out for, that would be great as this is my first time designing a RESTful app. Thanks again.
widgetAPI.com/tabs/1 -> Returns meta data (title) of tab id 1. If sent
with POST, updates tab id 1.
A POST to the above URL should not update tab 1. A PUT to that URL should update tab 1.
widgetAPI.com/tabs/create -> Create a new tab
To create a new tab, you should POST to widgetAPI.com/tabs
widgetAPI.com/tabs/delete/123 -> Delete tabid 123
To delete tab 123, send a DELETE to widgetAPI.com/tabs/123
widgetAPI.com/widgets/123 -> Return data for widgetInstanceId 123. Updates 123 if sent through POST
To update widget 123, send a PUT to widgetAPI.com/widgets/123
widgetAPI.com/widgets/Create?typeID = 2 -> Creates a new widgetInstance of typeid = 2. This will only be a POST request so typeId could be a post parameter.
To create a new widget, send a POST to widgetAPI.com/widgets. The typeId should be part of the POST request body.
widgetAPI.com/widgets/delete/123 -> Delete widgetInstance 123
To delete widget 123, send a DELETE request to widgetAPI.com/widgets/123
Answer 1: I like the widgetAPI.com/tabs/1/widgets URL design. Also, I like the idea of making 2 separate calls for the metadata and the data.
Answer 2: I think you should do this with a separate controller. I don't like the URL though. Instead, I like HTTP GET widgetAPI.com/widget-types or just widgetAPI.com/widgettypes.
As a general rule, unless you want your clients to be able to create URL identifiers, follow this pattern:
URL: /whatever-resource
GET - returns all resources of this type
POST - create a new resource
URL: /whatever-resource/{id}
GET - return single resource with that id
PUT - update resource with that id
DELETE - delete resource with that id
You can also allow PUT requests to /whatever-resource/{id} to create a resource, but the client / user must specify the id (implicitly, the URL, since the URL contains the id). If you don't want users to provide this, but rather have the server generate it, then POST to /whatever-resource to create the resource.
I am using listview to filter a large number of items. Each item is a link to another page which I use to edit details for the selected item. How can I return to my listview and have it remember the filter text I had previously typed?
You should send the filter data to your backend framework as a url query string, and let it handle the data and request redirects. For eg:
When someone clicks on a link, send to url such as www.example.com/page.html?filter1=xyz&filter2=abc
Use the filter to create the form submission data, or however you want it to persist. You might want to use signals or post query with included filter data.
i have this code in my membership service class (taken from the asp.net-mvc sample app)
public MembershipUserCollection GetUnapprovedUsers()
{
MembershipUserCollection users = Membership.GetAllUsers();
MembershipUserCollection unapprovedUsers = new MembershipUserCollection();
foreach (MembershipUser u in users)
{
if (!u.IsApproved)
{
unapprovedUsers.Add(u);
}
}
return unapprovedUsers;
}
i now need a view to show this list of information and allow someone to approve them which will go back to the controller and set the IsApproved property to true.
Create a view which will generate a form containing label and checkbox for each member of the collection. You need to be able to get from the id of the checkbox to the user.
In the HTTP.POST Action method, iterate through the submitted fields looking for set checkboxes, when you find one set the corresponding user to approved.
Obviously the form can display arbitrary details for each user.
To use the inbuilt control helpers takes a bit more effort because you don't have a fixed size model to work with. To achieve something similar I:
Used a non-strongly typed view
populated ViewData["ids"] with IEnumerable<IdType> (which the view would loop over)
For each entry populated ViewData["field" + id] for each field I was displaying in the entity
In the view looped over the ids using ViewData["ids"] to call the HTML helpers with the id of the field.
(That was V1, in V2 I used model state so I could use the inbuilt validation error display support, but that doesn't really apply if you just want to select users.)
The POST processing was similar, repopulating the id list from the database and the looking up in the passed FormCollection.