Skip to content

Commit cf13e08

Browse files
committed
- updated readme for edit link
1 parent d3b588a commit cf13e08

File tree

2 files changed

+24
-31
lines changed

2 files changed

+24
-31
lines changed

Our.Umbraco.TagHelpers/EditLinkTagHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using Microsoft.AspNetCore.Razor.TagHelpers;
1+
using Microsoft.AspNetCore.Mvc.Rendering;
2+
using Microsoft.AspNetCore.Razor.TagHelpers;
23
using Our.Umbraco.TagHelpers.Extensions;
34
using Our.Umbraco.TagHelpers.Services;
45
using System.Text;
5-
using Microsoft.AspNetCore.Mvc.Rendering;
66
using System.Threading.Tasks;
77
using Umbraco.Cms.Core.Web;
88

@@ -48,7 +48,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
4848
// Turn <our-edit-link> into an <a> tag
4949
output.TagName = "a";
5050

51-
// An outter wrapper div if we use inbuilt styling
51+
// An outer wrapper div if we use inbuilt styling
5252
var outerDiv = new TagBuilder("div");
5353

5454
// Check if the user is logged in to the backoffice

README.md

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -230,52 +230,45 @@ There are two special Member Groups you can use:
230230
## `<our-edit-link>`
231231
This is a tag helper element which renders an edit link on the front end only if the current user is logged into umbraco and has access to the content section.
232232

233-
The edit link will open the current page in the umbraco backoffice. You can override the link text and the umbraco url if you are using a different url for the backoffice.
233+
The link will open the current page in the umbraco backoffice. You can override the umbraco url if you are using a different url for the backoffice.
234234

235235
### Simple example
236-
This is the most basic example. You need to pass in the id of the content item using the `content-id` attribute. The link will render wherever you put it in the HTML.
236+
This is the most basic example. The link will render wherever you put it in the HTML.
237237

238-
```cshtml
239-
<our-edit-link content-id="@(Model.Id)" />
238+
```html
239+
<our-edit-link>Edit</our-edit-link>
240240
```
241241

242-
### Use Default Styles example
243-
244-
If you set `use-default-styles` to `true`, it will render the link fixed to the bottom left of the screen with white text and a navy blue background.
242+
It will output a link link this, where 1057 is the id of the current page:
245243

246-
```cshtml
247-
<our-edit-link content-id="@(Model.Id)" use-default-styles="true" />
244+
```html
245+
<a href="/umbraco#/content/content/edit/1057">Edit</a>
248246
```
249247

250-
### Changing the link text
251-
252-
You can change the link text by adding a `text` attribute:
253-
254-
```cshtml
255-
<our-edit-link content-id="@(Model.Id)" text="✍" />
256-
```
248+
### Use Default Styles example
257249

258-
If you have a multilingual site you could use a dictionary value:
250+
If you add an attribute of `use-default-styles`, it will render the link fixed to the bottom left of the screen with white text and a navy blue background.
259251

260-
```cshtml
261-
<our-edit-link content-id="@(Model.Id)" text="@(Umbraco.GetDictionaryValue("EditLinkText"))" />
252+
```html
253+
<our-edit-link use-default-styles>Edit</our-edit-link>
262254
```
263255

264-
### Change the edit link url
256+
### Change the edit url
265257

266258
Perhaps you have changed your umbraco path to something different, you can use the `edit-url` attribute to change the umbraco edit content url:
267259

268-
```cshtml
269-
<our-edit-link content-id="@(Model.Id)" edit-url="/mysecretumbracopath#/content/content/edit/" />
260+
```html
261+
<our-edit-link edit-url="/mysecretumbracopath#/content/content/edit/">Edit</our-edit-link>
270262
```
271263

272-
**Here are the other attributes you can set, just like on a normal `a` tag:**
264+
### Open in a new tab
265+
266+
As the edit link is just an `a` tag, you can add the usual attributes like `target` and `class` etc.
267+
If you want the edit link to open in a new tab, just add the `target="_blank"` attribute.
273268

274-
- id
275-
- class
276-
- target (defaults to `_blank`)
277-
- style
278-
- title
269+
```html
270+
<our-edit-link target="_blank">Edit</our-edit-link>
271+
```
279272

280273
## Video 📺
281274
[![How to create ASP.NET TagHelpers for Umbraco](https://user-images.githubusercontent.com/1389894/138666925-15475216-239f-439d-b989-c67995e5df71.png)](https://www.youtube.com/watch?v=3fkDs0NwIE8)

0 commit comments

Comments
 (0)