2

The add button that appears over the 2sxc items is missing all of a sudden. It was there a couple days agao but now when I log into any portal in my DNN instance the "+" or add button is missing

here is a screen shot: enter image description here

As you can see, the change layout and edit buttons are there. Not sure why the add button disappeared.

This is true for apps that I import from the 2sxc.org website as well. So I know its not just my template becasue it also happens on all the apps I have created which use different templates.

But to be thorough, here is my template code, its token based:

<div class="kr-gallery animation">
    <p>Hover or touch image and click brush icon for more details</p>
      <div class="isotope_grid isotope_grid2">
        <div class="isotope_main animation" data-min-width="230">
            <repeat repeat="Content in Data:Default">
                <div class="isotope_item kr-gallery-item sc-element">[Content:Toolbar]
                    <div class="photo"><a href="[Tab:FullUrl]/details/[Content:EntityId]"> <img alt="" src="[Content:Image]?h=500" /> 
                    <span class="fa  fa-paint-brush"></span></a> 
                    </div>
                </div>
            </repeat>
        </div>
      </div>
</div>

Any idea why this is?

UPDATE:

Here is my visual query:

enter image description here

SOLUTION:

Based on answer, I switched to razor because I am using a custom query. Here is my simple template code now:

@* this will show an "add" button if the current user is an editor *@
@Edit.Toolbar(actions: "new", contentType: "Image")

@{
    // get all images as delived from the standard query
    var images = AsDynamic(Data["Default"]);
}


<div class="kr-gallery animation">
    <p>Hover or touch image and click brush icon for more details</p>
    <div class="isotope_grid isotope_grid2">
        <div class="isotope_main animation" data-min-width="230">
            @foreach(var img in images)
            {
                <div class="isotope_item kr-gallery-item sc-element">@img.Toolbar
                    <div class="photo"><a href="@Link.To(parameters: "details=" + img.EntityId)"> <img alt="@img.Title" src="@img.Image?h=500" /> 
                    <span class="fa  fa-paint-brush"></span></a> 
                    </div>
                </div>
            }
        </div>
    </div>
</div>
J King
  • 4,108
  • 10
  • 53
  • 103

2 Answers2

2

The missing + is by design, because editors are used to the + adding an item right after the previous one. This behavior cannot be guaranteed with a query, as the order of things is determined by the query. It is even possible, that adding an item will not show up, if a query-parameter hides that item.

So the design pattern is to provide a separate + button. The easiest way is in razor, I believe the code is something like

@Edit.Toolbar(actions: "new", contentType: "your-content-type-name")

In Tokens it's a bit more messy, and you cannot conditionally check if a user has edit-permissions.

So I recommend you go the edit.toolbar way

You can also find an example of this in the blog app: http://2sxc.org/en/apps/app/dnn-blog-app-for-dnn-dotnetnuke

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21
  • thanks Daniel, I was playing around with tokens but usually use razor, went back to razor and added your suggestions and everything works. I updated my answer with my working code for future reference. – J King Jun 13 '16 at 14:13
0

I could be wrong but did you recently experiment with the visual query designer? Because this could be the cause.

The most common reason is when you use a pipeline (visual query) to deliver data to a template, which is not assigned to this instance. Reason is that "add" in a instance-list of items add it to a specific position (like right after the first one). This isn't the same when you use data like a data base - as there is no sorting in that scenario. So if this is the cause, I'll help you more.

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21
  • i think this is exactly the issue. I removed the moduledatasource in the visual query like in your simple news app demo. I want all items for the portal, then filter by a boolean available, then filter by a string category. I updated my question with a screen shot of my visual query. – J King Jun 10 '16 at 13:45