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

Display "Edit" link on the product details page (public store) if a user has such permission #21

Closed
mariannk opened this issue Jan 14, 2016 · 0 comments
Assignees
Milestone

Comments

@mariannk
Copy link

mariannk commented Jan 14, 2016

When browsing products in public store, show link 'Edit Product', when user is administrator (or have sufficient rights). Great time-saver for minor changes in products

  1. Add public bool CurrentUserHasEditPermission { get; set; } to \Models\Catalog\ProductDetailsModel.cs

  2. To ProductController, PrepareProductDetailsModel add
    //does the current user have edit permission?
    model.CurrentUserHasEditPermission = _permissionService.Authorize(StandardPermissionProvider.AccessAdminPanel) &&
    _permissionService.Authorize(StandardPermissionProvider.ManageProducts);

  3. To \Views\Product\ProductTemplate.Simple.cshtml and \Views\Product\ProductTemplate.Griouped.cshtml add something like the code below

                    @if (Model.CurrentUserHasEditPermission)
                    {
                        <div class="edit-product">
                            <a href="@Url.Action("Edit", "Product", new {id = Model.Id, area = "Admin"})">@T("Common.Edit")</a>
                        </div>
                    }
    

We just need to create better UI. Good idea - http://codepen.io/MeredithU/pen/jcsvx (but should we attach "font-awesome" just for one icon?

Please see http://www.nopcommerce.com/boards/t/41611/feature-request-front-end-edit-option-for-admins.aspx (put it to the top -"Administration" link)
P.S. Right now ignore for vendors

@mariannk mariannk added this to the Version 3.80 milestone Jan 14, 2016
@AndreiMaz AndreiMaz changed the title Public store. Display "Edit" link to appropriate admin pages if a user has an appropriate permissions (e.g. "Edit product") Public store. Display "Edit" link on the product details page if a user has such permission Mar 8, 2016
@AndreiMaz AndreiMaz changed the title Public store. Display "Edit" link on the product details page if a user has such permission Display "Edit" link on the product details page (public store) if a user has such permission Mar 8, 2016
@AndreiMaz AndreiMaz assigned AndreiMaz and unassigned mariannk Apr 23, 2016
AndreiMaz added a commit that referenced this issue Apr 23, 2016
…s, categories, manufacturers, vendors, topics, blog posts, news)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants